fix many warnings

remove btMultiSapBroadphase.*
make collisionFilterGroup/collisionFilterMark int (instead of short int)
This commit is contained in:
Erwin Coumans
2017-01-15 22:26:11 -08:00
parent e3df00d5f1
commit c0c4c8ba3f
146 changed files with 830 additions and 1431 deletions

View File

@@ -705,6 +705,7 @@ float computeConcavity(unsigned int vcount,
} }
} }
#if 0
if ( ftris.size() && 0 ) if ( ftris.size() && 0 )
{ {
@@ -725,17 +726,17 @@ float computeConcavity(unsigned int vcount,
do do
{ {
found = false; found = false;
CTriVector::iterator i; CTriVector::iterator i;
for (i=ftris.begin(); i!=ftris.end(); ++i) for (i=ftris.begin(); i!=ftris.end(); ++i)
{ {
CTri &t = (*i); CTri &t = (*i);
if ( isFeatureTri(t,flist,maxc,callback,color) ) if ( isFeatureTri(t,flist,maxc,callback,color) )
{ {
found = true; found = true;
totalarea+=t.area(); totalarea+=t.area();
} }
} }
} while ( found ); } while ( found );
@@ -759,6 +760,7 @@ float computeConcavity(unsigned int vcount,
} }
} }
} }
} }
unsigned int color = getDebugColor(); unsigned int color = getDebugColor();
@@ -786,7 +788,7 @@ float computeConcavity(unsigned int vcount,
hl.ReleaseResult(result); hl.ReleaseResult(result);
} }
#endif
return cret; return cret;
} }

View File

@@ -349,7 +349,8 @@ static int name_is_array(char* name, int* dim1, int* dim2) {
void bDNA::init(char *data, int len, bool swap) void bDNA::init(char *data, int len, bool swap)
{ {
int *intPtr=0;short *shtPtr=0; int *intPtr=0;short *shtPtr=0;
char *cp = 0;int dataLen =0;long nr=0; char *cp = 0;int dataLen =0;
//long nr=0;
intPtr = (int*)data; intPtr = (int*)data;
/* /*

View File

@@ -411,7 +411,7 @@ void bFile::swapDNA(char* ptr)
// void bDNA::init(char *data, int len, bool swap) // void bDNA::init(char *data, int len, bool swap)
int *intPtr=0;short *shtPtr=0; int *intPtr=0;short *shtPtr=0;
char *cp = 0;int dataLen =0;long nr=0; char *cp = 0;int dataLen =0;
intPtr = (int*)data; intPtr = (int*)data;
/* /*
@@ -573,7 +573,7 @@ void bFile::writeFile(const char* fileName)
void bFile::preSwap() void bFile::preSwap()
{ {
const bool brokenDNA = (mFlags&FD_BROKEN_DNA)!=0; //const bool brokenDNA = (mFlags&FD_BROKEN_DNA)!=0;
//FD_ENDIAN_SWAP //FD_ENDIAN_SWAP
//byte 8 determines the endianness of the file, little (v) versus big (V) //byte 8 determines the endianness of the file, little (v) versus big (V)
int littleEndian= 1; int littleEndian= 1;
@@ -1285,7 +1285,7 @@ int bFile::resolvePointersStructRecursive(char *strcPtr, int dna_nr, int verbose
} }
//skip the * //skip the *
printf("<%s type=\"pointer\"> ",&memName[1]); printf("<%s type=\"pointer\"> ",&memName[1]);
printf("%d ", array[a]); printf("%p ", array[a]);
printf("</%s>\n",&memName[1]); printf("</%s>\n",&memName[1]);
} }
@@ -1303,7 +1303,7 @@ int bFile::resolvePointersStructRecursive(char *strcPtr, int dna_nr, int verbose
printf(" "); printf(" ");
} }
printf("<%s type=\"pointer\"> ",&memName[1]); printf("<%s type=\"pointer\"> ",&memName[1]);
printf("%d ", ptr); printf("%p ", ptr);
printf("</%s>\n",&memName[1]); printf("</%s>\n",&memName[1]);
} }
ptr = findLibPointer(ptr); ptr = findLibPointer(ptr);
@@ -1484,7 +1484,7 @@ void bFile::resolvePointers(int verboseMode)
char* oldType = fileDna->getType(oldStruct[0]); char* oldType = fileDna->getType(oldStruct[0]);
if (verboseMode & FD_VERBOSE_EXPORT_XML) if (verboseMode & FD_VERBOSE_EXPORT_XML)
printf(" <%s pointer=%d>\n",oldType,dataChunk.oldPtr); printf(" <%s pointer=%p>\n",oldType,dataChunk.oldPtr);
resolvePointersChunk(dataChunk, verboseMode); resolvePointersChunk(dataChunk, verboseMode);

View File

@@ -307,8 +307,6 @@ bool btBulletWorldImporter::convertAllObjects( bParse::btBulletFile* bulletFile
for (i=0;i<bulletFile2->m_constraints.size();i++) for (i=0;i<bulletFile2->m_constraints.size();i++)
{ {
btTypedConstraintData2* constraintData = (btTypedConstraintData2*)bulletFile2->m_constraints[i]; btTypedConstraintData2* constraintData = (btTypedConstraintData2*)bulletFile2->m_constraints[i];
btTypedConstraintFloatData* singleC = (btTypedConstraintFloatData*)bulletFile2->m_constraints[i];
btTypedConstraintDoubleData* doubleC = (btTypedConstraintDoubleData*)bulletFile2->m_constraints[i];
btCollisionObject** colAptr = m_bodyMap.find(constraintData->m_rbA); btCollisionObject** colAptr = m_bodyMap.find(constraintData->m_rbA);
btCollisionObject** colBptr = m_bodyMap.find(constraintData->m_rbB); btCollisionObject** colBptr = m_bodyMap.find(constraintData->m_rbB);

View File

@@ -468,14 +468,11 @@ btCollisionShape* btWorldImporter::convertCollisionShape( btCollisionShapeData*
btCompoundShapeData* compoundData = (btCompoundShapeData*)shapeData; btCompoundShapeData* compoundData = (btCompoundShapeData*)shapeData;
btCompoundShape* compoundShape = createCompoundShape(); btCompoundShape* compoundShape = createCompoundShape();
btCompoundShapeChildData* childShapeDataArray = &compoundData->m_childShapePtr[0];
btAlignedObjectArray<btCollisionShape*> childShapes; btAlignedObjectArray<btCollisionShape*> childShapes;
for (int i=0;i<compoundData->m_numChildShapes;i++) for (int i=0;i<compoundData->m_numChildShapes;i++)
{ {
btCompoundShapeChildData* ptr = &compoundData->m_childShapePtr[i];
btCollisionShapeData* cd = compoundData->m_childShapePtr[i].m_childShape; btCollisionShapeData* cd = compoundData->m_childShapePtr[i].m_childShape;
btCollisionShape* childShape = convertCollisionShape(cd); btCollisionShape* childShape = convertCollisionShape(cd);

View File

@@ -18,6 +18,16 @@ subject to the following restrictions:
#include "btBulletDynamicsCommon.h" #include "btBulletDynamicsCommon.h"
#include "string_split.h" #include "string_split.h"
struct MyLocalCaster
{
void* m_ptr;
int m_int;
MyLocalCaster()
:m_ptr(0)
{
}
};
btBulletXmlWorldImporter::btBulletXmlWorldImporter(btDynamicsWorld* world) btBulletXmlWorldImporter::btBulletXmlWorldImporter(btDynamicsWorld* world)
:btWorldImporter(world), :btWorldImporter(world),
@@ -32,7 +42,7 @@ btBulletXmlWorldImporter::~btBulletXmlWorldImporter()
} }
#if 0
static int get_double_attribute_by_name(const TiXmlElement* pElement, const char* attribName,double* value) static int get_double_attribute_by_name(const TiXmlElement* pElement, const char* attribName,double* value)
{ {
if ( !pElement ) if ( !pElement )
@@ -48,7 +58,7 @@ static int get_double_attribute_by_name(const TiXmlElement* pElement, const char
} }
return 0; return 0;
} }
#endif
static int get_int_attribute_by_name(const TiXmlElement* pElement, const char* attribName,int* value) static int get_int_attribute_by_name(const TiXmlElement* pElement, const char* attribName,int* value)
{ {
@@ -130,7 +140,9 @@ void btBulletXmlWorldImporter::deSerializeVector3FloatData(TiXmlNode* pParent,bt
if (node)\ if (node)\
{\ {\
const char* txt = (node)->ToElement()->GetText();\ const char* txt = (node)->ToElement()->GetText();\
(targetdata).argname= (pointertype) (int) atof(txt);\ MyLocalCaster cast;\
cast.m_int = (int) atof(txt);\
(targetdata).argname= (pointertype)cast.m_ptr;\
}\ }\
} }
@@ -216,8 +228,8 @@ void btBulletXmlWorldImporter::deSerializeCollisionShapeData(TiXmlNode* pParent,
void btBulletXmlWorldImporter::deSerializeConvexHullShapeData(TiXmlNode* pParent) void btBulletXmlWorldImporter::deSerializeConvexHullShapeData(TiXmlNode* pParent)
{ {
int ptr; MyLocalCaster cast;
get_int_attribute_by_name(pParent->ToElement(),"pointer",&ptr); get_int_attribute_by_name(pParent->ToElement(),"pointer",&cast.m_int);
btConvexHullShapeData* convexHullData = (btConvexHullShapeData*)btAlignedAlloc(sizeof(btConvexHullShapeData), 16); btConvexHullShapeData* convexHullData = (btConvexHullShapeData*)btAlignedAlloc(sizeof(btConvexHullShapeData), 16);
@@ -233,18 +245,33 @@ void btBulletXmlWorldImporter::deSerializeConvexHullShapeData(TiXmlNode* pParent
SET_VECTOR4_VALUE(xmlConvexInt,&convexHullData->m_convexInternalShapeData,m_localScaling) SET_VECTOR4_VALUE(xmlConvexInt,&convexHullData->m_convexInternalShapeData,m_localScaling)
SET_VECTOR4_VALUE(xmlConvexInt,&convexHullData->m_convexInternalShapeData,m_implicitShapeDimensions) SET_VECTOR4_VALUE(xmlConvexInt,&convexHullData->m_convexInternalShapeData,m_implicitShapeDimensions)
//convexHullData->m_unscaledPointsFloatPtr
//#define SET_POINTER_VALUE(xmlnode, targetdata, argname, pointertype)
{
TiXmlNode* node = pParent->FirstChild("m_unscaledPointsFloatPtr");
btAssert(node);
if (node)
{
const char* txt = (node)->ToElement()->GetText();
MyLocalCaster cast;
cast.m_int = (int) atof(txt);
(*convexHullData).m_unscaledPointsFloatPtr= (btVector3FloatData*) cast.m_ptr;
}
}
SET_POINTER_VALUE(pParent,*convexHullData,m_unscaledPointsFloatPtr,btVector3FloatData*); SET_POINTER_VALUE(pParent,*convexHullData,m_unscaledPointsFloatPtr,btVector3FloatData*);
SET_POINTER_VALUE(pParent,*convexHullData,m_unscaledPointsDoublePtr,btVector3DoubleData*); SET_POINTER_VALUE(pParent,*convexHullData,m_unscaledPointsDoublePtr,btVector3DoubleData*);
SET_INT_VALUE(pParent,convexHullData,m_numUnscaledPoints); SET_INT_VALUE(pParent,convexHullData,m_numUnscaledPoints);
m_collisionShapeData.push_back((btCollisionShapeData*)convexHullData); m_collisionShapeData.push_back((btCollisionShapeData*)convexHullData);
m_pointerLookup.insert((void*)ptr,convexHullData); m_pointerLookup.insert(cast.m_ptr,convexHullData);
} }
void btBulletXmlWorldImporter::deSerializeCompoundShapeChildData(TiXmlNode* pParent) void btBulletXmlWorldImporter::deSerializeCompoundShapeChildData(TiXmlNode* pParent)
{ {
int ptr; MyLocalCaster cast;
get_int_attribute_by_name(pParent->ToElement(),"pointer",&ptr); get_int_attribute_by_name(pParent->ToElement(),"pointer",&cast.m_int);
int numChildren = 0; int numChildren = 0;
btAlignedObjectArray<btCompoundShapeChildData>* compoundChildArrayPtr = new btAlignedObjectArray<btCompoundShapeChildData>; btAlignedObjectArray<btCompoundShapeChildData>* compoundChildArrayPtr = new btAlignedObjectArray<btCompoundShapeChildData>;
@@ -262,7 +289,9 @@ void btBulletXmlWorldImporter::deSerializeCompoundShapeChildData(TiXmlNode* pPar
SET_MATRIX33_VALUE(transNode,&compoundChildArrayPtr->at(i).m_transform,m_basis) SET_MATRIX33_VALUE(transNode,&compoundChildArrayPtr->at(i).m_transform,m_basis)
const char* txt = (colShapeNode)->ToElement()->GetText(); const char* txt = (colShapeNode)->ToElement()->GetText();
compoundChildArrayPtr->at(i).m_childShape = (btCollisionShapeData*) (int) atof(txt); MyLocalCaster cast;
cast.m_int = (int) atof(txt);
compoundChildArrayPtr->at(i).m_childShape = (btCollisionShapeData*) cast.m_ptr;
btAssert(childTypeNode->ToElement()); btAssert(childTypeNode->ToElement());
if (childTypeNode->ToElement()) if (childTypeNode->ToElement())
@@ -292,15 +321,15 @@ void btBulletXmlWorldImporter::deSerializeCompoundShapeChildData(TiXmlNode* pPar
{ {
m_compoundShapeChildDataArrays.push_back(compoundChildArrayPtr); m_compoundShapeChildDataArrays.push_back(compoundChildArrayPtr);
btCompoundShapeChildData* cd = &compoundChildArrayPtr->at(0); btCompoundShapeChildData* cd = &compoundChildArrayPtr->at(0);
m_pointerLookup.insert((void*)ptr,cd); m_pointerLookup.insert(cast.m_ptr,cd);
} }
} }
void btBulletXmlWorldImporter::deSerializeCompoundShapeData(TiXmlNode* pParent) void btBulletXmlWorldImporter::deSerializeCompoundShapeData(TiXmlNode* pParent)
{ {
int ptr; MyLocalCaster cast;
get_int_attribute_by_name(pParent->ToElement(),"pointer",&ptr); get_int_attribute_by_name(pParent->ToElement(),"pointer",&cast.m_int);
btCompoundShapeData* compoundData = (btCompoundShapeData*) btAlignedAlloc(sizeof(btCompoundShapeData),16); btCompoundShapeData* compoundData = (btCompoundShapeData*) btAlignedAlloc(sizeof(btCompoundShapeData),16);
@@ -319,7 +348,9 @@ void btBulletXmlWorldImporter::deSerializeCompoundShapeData(TiXmlNode* pParent)
while (node) while (node)
{ {
const char* txt = (node)->ToElement()->GetText(); const char* txt = (node)->ToElement()->GetText();
compoundData->m_childShapePtr = (btCompoundShapeChildData*) (int) atof(txt); MyLocalCaster cast;
cast.m_int = (int) atof(txt);
compoundData->m_childShapePtr = (btCompoundShapeChildData*) cast.m_ptr;
node = node->NextSibling("m_childShapePtr"); node = node->NextSibling("m_childShapePtr");
} }
//SET_POINTER_VALUE(xmlColShape, *compoundData,m_childShapePtr,btCompoundShapeChildData*); //SET_POINTER_VALUE(xmlColShape, *compoundData,m_childShapePtr,btCompoundShapeChildData*);
@@ -328,14 +359,14 @@ void btBulletXmlWorldImporter::deSerializeCompoundShapeData(TiXmlNode* pParent)
SET_FLOAT_VALUE(pParent, compoundData,m_collisionMargin); SET_FLOAT_VALUE(pParent, compoundData,m_collisionMargin);
m_collisionShapeData.push_back((btCollisionShapeData*)compoundData); m_collisionShapeData.push_back((btCollisionShapeData*)compoundData);
m_pointerLookup.insert((void*)ptr,compoundData); m_pointerLookup.insert(cast.m_ptr,compoundData);
} }
void btBulletXmlWorldImporter::deSerializeStaticPlaneShapeData(TiXmlNode* pParent) void btBulletXmlWorldImporter::deSerializeStaticPlaneShapeData(TiXmlNode* pParent)
{ {
int ptr; MyLocalCaster cast;
get_int_attribute_by_name(pParent->ToElement(),"pointer",&ptr); get_int_attribute_by_name(pParent->ToElement(),"pointer",&cast.m_int);
btStaticPlaneShapeData* planeData = (btStaticPlaneShapeData*) btAlignedAlloc(sizeof(btStaticPlaneShapeData),16); btStaticPlaneShapeData* planeData = (btStaticPlaneShapeData*) btAlignedAlloc(sizeof(btStaticPlaneShapeData),16);
@@ -348,7 +379,7 @@ void btBulletXmlWorldImporter::deSerializeStaticPlaneShapeData(TiXmlNode* pParen
SET_FLOAT_VALUE(pParent, planeData,m_planeConstant); SET_FLOAT_VALUE(pParent, planeData,m_planeConstant);
m_collisionShapeData.push_back((btCollisionShapeData*)planeData); m_collisionShapeData.push_back((btCollisionShapeData*)planeData);
m_pointerLookup.insert((void*)ptr,planeData); m_pointerLookup.insert(cast.m_ptr,planeData);
} }
@@ -364,8 +395,8 @@ void btBulletXmlWorldImporter::deSerializeDynamicsWorldData(TiXmlNode* pParent)
void btBulletXmlWorldImporter::deSerializeConvexInternalShapeData(TiXmlNode* pParent) void btBulletXmlWorldImporter::deSerializeConvexInternalShapeData(TiXmlNode* pParent)
{ {
int ptr=0; MyLocalCaster cast;
get_int_attribute_by_name(pParent->ToElement(),"pointer",&ptr); get_int_attribute_by_name(pParent->ToElement(),"pointer",&cast.m_int);
btConvexInternalShapeData* convexShape = (btConvexInternalShapeData*) btAlignedAlloc(sizeof(btConvexInternalShapeData),16); btConvexInternalShapeData* convexShape = (btConvexInternalShapeData*) btAlignedAlloc(sizeof(btConvexInternalShapeData),16);
@@ -382,7 +413,7 @@ void btBulletXmlWorldImporter::deSerializeConvexInternalShapeData(TiXmlNode* pPa
SET_VECTOR4_VALUE(pParent,convexShape,m_implicitShapeDimensions) SET_VECTOR4_VALUE(pParent,convexShape,m_implicitShapeDimensions)
m_collisionShapeData.push_back((btCollisionShapeData*)convexShape); m_collisionShapeData.push_back((btCollisionShapeData*)convexShape);
m_pointerLookup.insert((void*)ptr,convexShape); m_pointerLookup.insert(cast.m_ptr,convexShape);
} }
@@ -404,8 +435,8 @@ enum btTypedConstraintType
void btBulletXmlWorldImporter::deSerializeGeneric6DofConstraintData(TiXmlNode* pParent) void btBulletXmlWorldImporter::deSerializeGeneric6DofConstraintData(TiXmlNode* pParent)
{ {
int ptr=0; MyLocalCaster cast;
get_int_attribute_by_name(pParent->ToElement(),"pointer",&ptr); get_int_attribute_by_name(pParent->ToElement(),"pointer",&cast.m_int);
btGeneric6DofConstraintData2* dof6Data = (btGeneric6DofConstraintData2*)btAlignedAlloc(sizeof(btGeneric6DofConstraintData2),16); btGeneric6DofConstraintData2* dof6Data = (btGeneric6DofConstraintData2*)btAlignedAlloc(sizeof(btGeneric6DofConstraintData2),16);
@@ -439,13 +470,14 @@ void btBulletXmlWorldImporter::deSerializeGeneric6DofConstraintData(TiXmlNode* p
SET_INT_VALUE(pParent, dof6Data,m_useOffsetForConstraintFrame); SET_INT_VALUE(pParent, dof6Data,m_useOffsetForConstraintFrame);
m_constraintData.push_back((btTypedConstraintData2*)dof6Data); m_constraintData.push_back((btTypedConstraintData2*)dof6Data);
m_pointerLookup.insert((void*)ptr,dof6Data); m_pointerLookup.insert(cast.m_ptr,dof6Data);
} }
void btBulletXmlWorldImporter::deSerializeRigidBodyFloatData(TiXmlNode* pParent) void btBulletXmlWorldImporter::deSerializeRigidBodyFloatData(TiXmlNode* pParent)
{ {
int ptr=0; MyLocalCaster cast;
if (!get_int_attribute_by_name(pParent->ToElement(),"pointer",&ptr))
if (!get_int_attribute_by_name(pParent->ToElement(),"pointer",&cast.m_int))
{ {
m_fileOk = false; m_fileOk = false;
return; return;
@@ -506,7 +538,7 @@ void btBulletXmlWorldImporter::deSerializeRigidBodyFloatData(TiXmlNode* pParent)
m_rigidBodyData.push_back(rbData); m_rigidBodyData.push_back(rbData);
m_pointerLookup.insert((void*)ptr,rbData); m_pointerLookup.insert(cast.m_ptr,rbData);
// rbData->m_collisionObjectData.m_collisionShape = (void*) (int)atof(txt); // rbData->m_collisionObjectData.m_collisionShape = (void*) (int)atof(txt);
} }
@@ -641,8 +673,8 @@ void btBulletXmlWorldImporter::auto_serialize_root_level_children(TiXmlNode* pPa
// printf("child Name=%s\n", pChild->Value()); // printf("child Name=%s\n", pChild->Value());
if (!strcmp(pChild->Value(),"btVector3FloatData")) if (!strcmp(pChild->Value(),"btVector3FloatData"))
{ {
int ptr; MyLocalCaster cast;
get_int_attribute_by_name(pChild->ToElement(),"pointer",&ptr); get_int_attribute_by_name(pChild->ToElement(),"pointer",&cast.m_int);
btAlignedObjectArray<btVector3FloatData> v; btAlignedObjectArray<btVector3FloatData> v;
deSerializeVector3FloatData(pChild,v); deSerializeVector3FloatData(pChild,v);
@@ -651,7 +683,7 @@ void btBulletXmlWorldImporter::auto_serialize_root_level_children(TiXmlNode* pPa
for (int i=0;i<numVectors;i++) for (int i=0;i<numVectors;i++)
vectors[i] = v[i]; vectors[i] = v[i];
m_floatVertexArrays.push_back(vectors); m_floatVertexArrays.push_back(vectors);
m_pointerLookup.insert((void*)ptr,vectors); m_pointerLookup.insert(cast.m_ptr,vectors);
continue; continue;
} }
@@ -790,7 +822,7 @@ void btBulletXmlWorldImporter::auto_serialize_root_level_children(TiXmlNode* pPa
for (int i=0;i<m_constraintData.size();i++) for (int i=0;i<m_constraintData.size();i++)
{ {
btTypedConstraintData2* tcd = m_constraintData[i]; btTypedConstraintData2* tcd = m_constraintData[i];
bool isDoublePrecision = false; // bool isDoublePrecision = false;
btRigidBody* rbA = 0; btRigidBody* rbA = 0;
btRigidBody* rbB = 0; btRigidBody* rbB = 0;
{ {

View File

@@ -21,7 +21,7 @@
<geometry> <geometry>
<mesh> <mesh>
<scale>1 1 1</scale> <scale>1 1 1</scale>
<uri>meshes/coarse/link_0.stl</uri> <uri>meshes/link_0.stl</uri>
</mesh> </mesh>
</geometry> </geometry>
</collision> </collision>
@@ -60,7 +60,7 @@
<geometry> <geometry>
<mesh> <mesh>
<scale>1 1 1</scale> <scale>1 1 1</scale>
<uri>meshes/coarse/link_1.stl</uri> <uri>meshes/link_1.stl</uri>
</mesh> </mesh>
</geometry> </geometry>
</collision> </collision>
@@ -119,7 +119,7 @@
<geometry> <geometry>
<mesh> <mesh>
<scale>1 1 1</scale> <scale>1 1 1</scale>
<uri>meshes/coarse/link_2.stl</uri> <uri>meshes/link_2.stl</uri>
</mesh> </mesh>
</geometry> </geometry>
</collision> </collision>
@@ -178,7 +178,7 @@
<geometry> <geometry>
<mesh> <mesh>
<scale>1 1 1</scale> <scale>1 1 1</scale>
<uri>meshes/coarse/link_3.stl</uri> <uri>meshes/link_3.stl</uri>
</mesh> </mesh>
</geometry> </geometry>
</collision> </collision>
@@ -237,7 +237,7 @@
<geometry> <geometry>
<mesh> <mesh>
<scale>1 1 1</scale> <scale>1 1 1</scale>
<uri>meshes/coarse/link_4.stl</uri> <uri>meshes/link_4.stl</uri>
</mesh> </mesh>
</geometry> </geometry>
</collision> </collision>
@@ -296,7 +296,7 @@
<geometry> <geometry>
<mesh> <mesh>
<scale>1 1 1</scale> <scale>1 1 1</scale>
<uri>meshes/coarse/link_5.stl</uri> <uri>meshes/link_5.stl</uri>
</mesh> </mesh>
</geometry> </geometry>
</collision> </collision>
@@ -355,7 +355,7 @@
<geometry> <geometry>
<mesh> <mesh>
<scale>1 1 1</scale> <scale>1 1 1</scale>
<uri>meshes/coarse/link_6.stl</uri> <uri>meshes/link_6.stl</uri>
</mesh> </mesh>
</geometry> </geometry>
</collision> </collision>
@@ -414,7 +414,7 @@
<geometry> <geometry>
<mesh> <mesh>
<scale>1 1 1</scale> <scale>1 1 1</scale>
<uri>meshes/coarse/link_7.stl</uri> <uri>meshes/link_7.stl</uri>
</mesh> </mesh>
</geometry> </geometry>
</collision> </collision>

Binary file not shown.

View File

@@ -74,7 +74,7 @@ ELSE(WIN32)
IF(APPLE) IF(APPLE)
find_library(COCOA NAMES Cocoa) find_library(COCOA NAMES Cocoa)
MESSAGE(${COCOA}) MESSAGE(${COCOA})
link_libraries(${COCOA}) link_libraries(${COCOA} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY})
ELSE(APPLE) ELSE(APPLE)
INCLUDE_DIRECTORIES( INCLUDE_DIRECTORIES(

View File

@@ -228,9 +228,10 @@ public:
struct CastRaysLoopBody struct CastRaysLoopBody
{ {
btRaycastBar2* mRaycasts;
btCollisionWorld* mWorld; btCollisionWorld* mWorld;
CastRaysLoopBody(btCollisionWorld* cw, btRaycastBar2* rb) : mWorld(cw), mRaycasts(rb) {} btRaycastBar2* mRaycasts;
CastRaysLoopBody(btCollisionWorld* cw, btRaycastBar2* rb) : mWorld(cw), mRaycasts(rb) {}
void forLoop( int iBegin, int iEnd ) const void forLoop( int iBegin, int iEnd ) const
{ {

View File

@@ -61,8 +61,8 @@ class CollisionTutorialBullet2 : public CommonExampleInterface
plCollisionSdkHandle m_collisionSdkHandle; plCollisionSdkHandle m_collisionSdkHandle;
plCollisionWorldHandle m_collisionWorldHandle; plCollisionWorldHandle m_collisionWorldHandle;
int m_stage; // int m_stage;
int m_counter; // int m_counter;
public: public:
@@ -70,11 +70,11 @@ public:
:m_app(guiHelper->getAppInterface()), :m_app(guiHelper->getAppInterface()),
m_guiHelper(guiHelper), m_guiHelper(guiHelper),
m_tutorialIndex(tutorialIndex), m_tutorialIndex(tutorialIndex),
m_timeSeriesCanvas0(0),
m_collisionSdkHandle(0), m_collisionSdkHandle(0),
m_collisionWorldHandle(0), m_collisionWorldHandle(0)
m_stage(0), // m_stage(0),
m_counter(0), // m_counter(0)
m_timeSeriesCanvas0(0)
{ {
gTotalPoints = 0; gTotalPoints = 0;

View File

@@ -6,13 +6,14 @@ struct Bullet2CollisionSdkInternalData
btCollisionConfiguration* m_collisionConfig; btCollisionConfiguration* m_collisionConfig;
btCollisionDispatcher* m_dispatcher; btCollisionDispatcher* m_dispatcher;
btBroadphaseInterface* m_aabbBroadphase; btBroadphaseInterface* m_aabbBroadphase;
btCollisionWorld* m_collisionWorld; btCollisionWorld* m_collisionWorld;
Bullet2CollisionSdkInternalData() Bullet2CollisionSdkInternalData()
:m_aabbBroadphase(0), :
m_dispatcher(0), m_collisionConfig(0),
m_collisionWorld(0) m_dispatcher(0),
m_aabbBroadphase(0),
m_collisionWorld(0)
{ {
} }
}; };

View File

@@ -53,13 +53,19 @@ struct RTB3CollisionWorld
b3AlignedObjectArray<b3Aabb> m_worldSpaceAabbs; b3AlignedObjectArray<b3Aabb> m_worldSpaceAabbs;
b3AlignedObjectArray<b3GpuFace> m_planeFaces; b3AlignedObjectArray<b3GpuFace> m_planeFaces;
b3AlignedObjectArray<b3CompoundOverlappingPair> m_compoundOverlappingPairs; b3AlignedObjectArray<b3CompoundOverlappingPair> m_compoundOverlappingPairs;
int m_nextFreeShapeIndex;
union
{
int m_nextFreeShapeIndex;
void* m_nextFreeShapePtr;
};
int m_nextFreeCollidableIndex; int m_nextFreeCollidableIndex;
int m_nextFreePlaneFaceIndex; int m_nextFreePlaneFaceIndex;
RTB3CollisionWorld() RTB3CollisionWorld()
:m_nextFreeCollidableIndex(START_COLLIDABLE_INDEX), :
m_nextFreeShapeIndex(START_SHAPE_INDEX), m_nextFreeShapeIndex(START_SHAPE_INDEX),
m_nextFreeCollidableIndex(START_COLLIDABLE_INDEX),
m_nextFreePlaneFaceIndex(0)//this value is never exposed to the user, so we can start from 0 m_nextFreePlaneFaceIndex(0)//this value is never exposed to the user, so we can start from 0
{ {
} }
@@ -125,7 +131,8 @@ plCollisionShapeHandle RealTimeBullet3CollisionSdk::createSphereShape(plCollisio
shape.m_childOrientation.setValue(0,0,0,1); shape.m_childOrientation.setValue(0,0,0,1);
shape.m_radius = radius; shape.m_radius = radius;
shape.m_shapeType = RTB3_SHAPE_SPHERE; shape.m_shapeType = RTB3_SHAPE_SPHERE;
return (plCollisionShapeHandle) world->m_nextFreeShapeIndex++; world->m_nextFreeShapeIndex++;
return (plCollisionShapeHandle) world->m_nextFreeShapePtr;
} }
return 0; return 0;
} }
@@ -147,7 +154,8 @@ plCollisionShapeHandle RealTimeBullet3CollisionSdk::createPlaneShape(plCollision
world->m_planeFaces[world->m_nextFreePlaneFaceIndex].m_plane = b3MakeVector4(planeNormalX,planeNormalY,planeNormalZ,planeConstant); world->m_planeFaces[world->m_nextFreePlaneFaceIndex].m_plane = b3MakeVector4(planeNormalX,planeNormalY,planeNormalZ,planeConstant);
shape.m_shapeIndex = world->m_nextFreePlaneFaceIndex++; shape.m_shapeIndex = world->m_nextFreePlaneFaceIndex++;
shape.m_shapeType = RTB3_SHAPE_PLANE; shape.m_shapeType = RTB3_SHAPE_PLANE;
return (plCollisionShapeHandle) world->m_nextFreeShapeIndex++; world->m_nextFreeShapeIndex++;
return (plCollisionShapeHandle)world->m_nextFreeShapePtr ;
} }
return 0; return 0;
} }
@@ -169,7 +177,8 @@ plCollisionShapeHandle RealTimeBullet3CollisionSdk::createCapsuleShape(plCollisi
shape.m_height = height; shape.m_height = height;
shape.m_shapeIndex = capsuleAxis; shape.m_shapeIndex = capsuleAxis;
shape.m_shapeType = RTB3_SHAPE_CAPSULE; shape.m_shapeType = RTB3_SHAPE_CAPSULE;
return (plCollisionShapeHandle) world->m_nextFreeShapeIndex++; world->m_nextFreeShapeIndex++;
return (plCollisionShapeHandle) world->m_nextFreeShapePtr;
} }
return 0; return 0;
} }
@@ -186,7 +195,8 @@ plCollisionShapeHandle RealTimeBullet3CollisionSdk::createCompoundShape(plCollis
shape.m_childOrientation.setValue(0,0,0,1); shape.m_childOrientation.setValue(0,0,0,1);
shape.m_numChildShapes = 0; shape.m_numChildShapes = 0;
shape.m_shapeType = RTB3_SHAPE_COMPOUND_INTERNAL; shape.m_shapeType = RTB3_SHAPE_COMPOUND_INTERNAL;
return (plCollisionShapeHandle) world->m_nextFreeShapeIndex++; world->m_nextFreeShapeIndex++;
return (plCollisionShapeHandle) world->m_nextFreeShapePtr;
} }
return 0; return 0;
} }
@@ -265,7 +275,8 @@ plCollisionObjectHandle RealTimeBullet3CollisionSdk::createCollisionObject( plC
collidable.m_shapeIndex = shape.m_shapeIndex; collidable.m_shapeIndex = shape.m_shapeIndex;
break; break;
*/ */
return (plCollisionObjectHandle)world->m_nextFreeCollidableIndex++; world->m_nextFreeCollidableIndex++;
return (plCollisionObjectHandle)world->m_nextFreeShapePtr;
} }
return 0; return 0;
} }

View File

@@ -56,7 +56,7 @@ class AllConstraintDemo : public CommonRigidBodyBase
m_guiHelper->resetCamera(dist,pitch,yaw,targetPos[0],targetPos[1],targetPos[2]); m_guiHelper->resetCamera(dist,pitch,yaw,targetPos[0],targetPos[1],targetPos[2]);
} }
virtual void keyboardCallback(unsigned char key, int x, int y); virtual bool keyboardCallback(int key, int state);
// for cone-twist motor driving // for cone-twist motor driving
float m_Time; float m_Time;
@@ -66,7 +66,6 @@ class AllConstraintDemo : public CommonRigidBodyBase
const int numObjects = 3;
#define ENABLE_ALL_DEMOS 1 #define ENABLE_ALL_DEMOS 1
@@ -839,10 +838,11 @@ void AllConstraintDemo::displayCallback(void) {
} }
#endif #endif
void AllConstraintDemo::keyboardCallback(unsigned char key, int x, int y) bool AllConstraintDemo::keyboardCallback(int key, int state)
{ {
(void)x;
(void)y; bool handled = false;
switch (key) switch (key)
{ {
case 'O' : case 'O' :
@@ -870,6 +870,7 @@ void AllConstraintDemo::keyboardCallback(unsigned char key, int x, int y)
printf("Slider6Dof %s frame offset\n", offectOnOff ? "uses" : "does not use"); printf("Slider6Dof %s frame offset\n", offectOnOff ? "uses" : "does not use");
} }
} }
handled = true;
break; break;
default : default :
{ {
@@ -877,6 +878,8 @@ void AllConstraintDemo::keyboardCallback(unsigned char key, int x, int y)
} }
break; break;
} }
return handled;
} }
class CommonExampleInterface* AllConstraintCreateFunc(struct CommonExampleOptions& options) class CommonExampleInterface* AllConstraintCreateFunc(struct CommonExampleOptions& options)

View File

@@ -443,8 +443,6 @@ void Dof6Spring2Setup::animate()
/////// servo motor: flip its target periodically /////// servo motor: flip its target periodically
#ifdef USE_6DOF2 #ifdef USE_6DOF2
static float servoNextFrame = -1; static float servoNextFrame = -1;
btScalar pos = m_data->m_ServoMotorConstraint->getRotationalLimitMotor(2)->m_currentPosition;
btScalar target = m_data->m_ServoMotorConstraint->getRotationalLimitMotor(2)->m_servoTarget;
if(servoNextFrame < 0) if(servoNextFrame < 0)
{ {
m_data->m_ServoMotorConstraint->getRotationalLimitMotor(2)->m_servoTarget *= -1; m_data->m_ServoMotorConstraint->getRotationalLimitMotor(2)->m_servoTarget *= -1;

View File

@@ -4,8 +4,8 @@
#include "../CommonInterfaces/CommonRigidBodyBase.h" #include "../CommonInterfaces/CommonRigidBodyBase.h"
#include "../CommonInterfaces/CommonParameterInterface.h" #include "../CommonInterfaces/CommonParameterInterface.h"
short collisionFilterGroup = short(btBroadphaseProxy::CharacterFilter); int collisionFilterGroup = int(btBroadphaseProxy::CharacterFilter);
short collisionFilterMask = short(btBroadphaseProxy::AllFilter ^ (btBroadphaseProxy::CharacterFilter)); int collisionFilterMask = int(btBroadphaseProxy::AllFilter ^ (btBroadphaseProxy::CharacterFilter));
static btScalar radius(0.2); static btScalar radius(0.2);
struct TestHingeTorque : public CommonRigidBodyBase struct TestHingeTorque : public CommonRigidBodyBase
@@ -123,9 +123,7 @@ void TestHingeTorque::initPhysics()
{ // create a door using hinge constraint attached to the world { // create a door using hinge constraint attached to the world
int numLinks = 2; int numLinks = 2;
bool spherical = false; //set it ot false -to use 1DoF hinges instead of 3DoF sphericals // bool selfCollide = false;
bool canSleep = false;
bool selfCollide = false;
btVector3 linkHalfExtents(0.05, 0.37, 0.1); btVector3 linkHalfExtents(0.05, 0.37, 0.1);
btVector3 baseHalfExtents(0.05, 0.37, 0.1); btVector3 baseHalfExtents(0.05, 0.37, 0.1);
@@ -223,7 +221,7 @@ void TestHingeTorque::initPhysics()
btTransform start; start.setIdentity(); btTransform start; start.setIdentity();
btVector3 groundOrigin(-0.4f, 3.f, 0.f); btVector3 groundOrigin(-0.4f, 3.f, 0.f);
btVector3 basePosition = btVector3(-0.4f, 3.f, 0.f); // btVector3 basePosition = btVector3(-0.4f, 3.f, 0.f);
btQuaternion groundOrn(btVector3(0,1,0),0.25*SIMD_PI); btQuaternion groundOrn(btVector3(0,1,0),0.25*SIMD_PI);
groundOrigin[upAxis] -=.5; groundOrigin[upAxis] -=.5;

View File

@@ -118,10 +118,10 @@ public:
:NN3DWalkersTimeWarpBase(helper), :NN3DWalkersTimeWarpBase(helper),
m_Time(0), m_Time(0),
m_SpeedupTimestamp(0), m_SpeedupTimestamp(0),
m_motorStrength(0.5f),
m_targetFrequency(3),
m_targetAccumulator(0), m_targetAccumulator(0),
m_evaluationsQty(0), m_targetFrequency(3),
m_motorStrength(0.5f),
m_evaluationsQty(0),
m_nextReaped(0), m_nextReaped(0),
m_timeSeriesCanvas(0) m_timeSeriesCanvas(0)
{ {
@@ -729,9 +729,9 @@ bool NN3DWalkersExample::detectCollisions()
btManifoldPoint& pt = contactManifold->getContactPoint(j); btManifoldPoint& pt = contactManifold->getContactPoint(j);
if (pt.getDistance()<0.f) if (pt.getDistance()<0.f)
{ {
const btVector3& ptA = pt.getPositionWorldOnA(); //const btVector3& ptA = pt.getPositionWorldOnA();
const btVector3& ptB = pt.getPositionWorldOnB(); //const btVector3& ptB = pt.getPositionWorldOnB();
const btVector3& normalOnB = pt.m_normalWorldOnB; //const btVector3& normalOnB = pt.m_normalWorldOnB;
if(!DRAW_INTERPENETRATIONS){ if(!DRAW_INTERPENETRATIONS){
return collisionDetected; return collisionDetected;

View File

@@ -593,7 +593,7 @@ struct NN3DWalkersTimeWarpBase: public CommonRigidBodyBase {
timeWarpSimulation(deltaTime); timeWarpSimulation(deltaTime);
if(mLoopTimer.getTimeSeconds() - speedUpPrintTimeStamp > 1){ if(mLoopTimer.getTimeSeconds() - speedUpPrintTimeStamp > 1){
// on reset, we calculate the performed speed up // on reset, we calculate the performed speed up
double speedUp = ((double)performedTime*1000.0)/((double)(mLoopTimer.getTimeMilliseconds()-performanceTimestamp)); //double speedUp = ((double)performedTime*1000.0)/((double)(mLoopTimer.getTimeMilliseconds()-performanceTimestamp));
// b3Printf("Avg Effective speedup: %f",speedUp); // b3Printf("Avg Effective speedup: %f",speedUp);
performedTime = 0; performedTime = 0;
performanceTimestamp = mLoopTimer.getTimeMilliseconds(); performanceTimestamp = mLoopTimer.getTimeMilliseconds();

View File

@@ -36,12 +36,13 @@ struct MySliderEventHandler : public Gwen::Event::Handler
bool m_showValue; bool m_showValue;
MySliderEventHandler(const char* varName, Gwen::Controls::TextBox* label, Gwen::Controls::Slider* pSlider,T* target, SliderParamChangedCallback callback, void* userPtr) MySliderEventHandler(const char* varName, Gwen::Controls::TextBox* label, Gwen::Controls::Slider* pSlider,T* target, SliderParamChangedCallback callback, void* userPtr)
:m_label(label), : m_callback(callback),
m_userPointer(userPtr),
m_label(label),
m_pSlider(pSlider), m_pSlider(pSlider),
m_targetValue(target), m_targetValue(target),
m_showValue(true), m_showValue(true)
m_callback(callback),
m_userPointer(userPtr)
{ {
memcpy(m_variableName,varName,strlen(varName)+1); memcpy(m_variableName,varName,strlen(varName)+1);
} }

View File

@@ -233,7 +233,7 @@ void ExampleBrowserThreadFunc(void* userPtr,void* lsMemory)
ExampleBrowserThreadLocalStorage* localStorage = (ExampleBrowserThreadLocalStorage*) lsMemory; ExampleBrowserThreadLocalStorage* localStorage = (ExampleBrowserThreadLocalStorage*) lsMemory;
ExampleBrowserArgs* args = (ExampleBrowserArgs*) userPtr; ExampleBrowserArgs* args = (ExampleBrowserArgs*) userPtr;
int workLeft = true; //int workLeft = true;
b3CommandLineArgs args2(args->m_argc,args->m_argv); b3CommandLineArgs args2(args->m_argc,args->m_argv);
b3Clock clock; b3Clock clock;
@@ -411,7 +411,8 @@ btInProcessExampleBrowserMainThreadInternalData* btCreateInProcessExampleBrowser
data->m_exampleBrowser = new DefaultBrowser(&data->m_examples); data->m_exampleBrowser = new DefaultBrowser(&data->m_examples);
data->m_sharedMem = new InProcessMemory; data->m_sharedMem = new InProcessMemory;
data->m_exampleBrowser->setSharedMemoryInterface(data->m_sharedMem ); data->m_exampleBrowser->setSharedMemoryInterface(data->m_sharedMem );
bool init = data->m_exampleBrowser->init(argc,argv); bool init;
init = data->m_exampleBrowser->init(argc,argv);
data->m_clock.reset(); data->m_clock.reset();
return data; return data;
} }

View File

@@ -721,7 +721,7 @@ static void saveCurrentSettings(int currentEntry,const char* startFileName)
static void loadCurrentSettings(const char* startFileName, b3CommandLineArgs& args) static void loadCurrentSettings(const char* startFileName, b3CommandLineArgs& args)
{ {
int currentEntry= 0; //int currentEntry= 0;
FILE* f = fopen(startFileName,"r"); FILE* f = fopen(startFileName,"r");
if (f) if (f)
{ {

View File

@@ -46,6 +46,7 @@ class btCollisionShape;
class ForkLiftDemo : public CommonExampleInterface class ForkLiftDemo : public CommonExampleInterface
{ {
public: public:
GUIHelperInterface* m_guiHelper;
/* extra stuff*/ /* extra stuff*/
btVector3 m_cameraPosition; btVector3 m_cameraPosition;
@@ -57,7 +58,6 @@ class ForkLiftDemo : public CommonExampleInterface
btRigidBody* m_carChassis; btRigidBody* m_carChassis;
btRigidBody* localCreateRigidBody(btScalar mass, const btTransform& worldTransform, btCollisionShape* colSape); btRigidBody* localCreateRigidBody(btScalar mass, const btTransform& worldTransform, btCollisionShape* colSape);
GUIHelperInterface* m_guiHelper;
int m_wheelInstances[4]; int m_wheelInstances[4];
//---------------------------- //----------------------------
@@ -195,8 +195,6 @@ bool useMCLPSolver = true;
#include "ForkLiftDemo.h" #include "ForkLiftDemo.h"
const int maxProxies = 32766;
const int maxOverlap = 65535;
///btRaycastVehicle is the interface for the constraint that implements the raycast vehicle ///btRaycastVehicle is the interface for the constraint that implements the raycast vehicle
///notice that for higher-quality slow-moving vehicles, another approach might be better ///notice that for higher-quality slow-moving vehicles, another approach might be better

View File

@@ -529,7 +529,7 @@ void btFractureDynamicsWorld::fractureCallback( )
{ {
int j=f0; int j=f0;
btCollisionObject* colOb = (btCollisionObject*)manifold->getBody1(); // btCollisionObject* colOb = (btCollisionObject*)manifold->getBody1();
// btRigidBody* otherOb = btRigidBody::upcast(colOb); // btRigidBody* otherOb = btRigidBody::upcast(colOb);
// if (!otherOb->getInvMass()) // if (!otherOb->getInvMass())
// continue; // continue;
@@ -562,8 +562,8 @@ void btFractureDynamicsWorld::fractureCallback( )
{ {
int j=f1; int j=f1;
{ {
btCollisionObject* colOb = (btCollisionObject*)manifold->getBody0(); //btCollisionObject* colOb = (btCollisionObject*)manifold->getBody0();
btRigidBody* otherOb = btRigidBody::upcast(colOb); //btRigidBody* otherOb = btRigidBody::upcast(colOb);
// if (!otherOb->getInvMass()) // if (!otherOb->getInvMass())
// continue; // continue;

View File

@@ -336,7 +336,7 @@ void readLibraryGeometries(TiXmlDocument& doc, btAlignedObjectArray<GLInstanceGr
void readNodeHierarchy(TiXmlElement* node,btHashMap<btHashString,int>& name2Shape, btAlignedObjectArray<ColladaGraphicsInstance>& visualShapeInstances, const btMatrix4x4& parentTransMat) void readNodeHierarchy(TiXmlElement* node,btHashMap<btHashString,int>& name2Shape, btAlignedObjectArray<ColladaGraphicsInstance>& visualShapeInstances, const btMatrix4x4& parentTransMat)
{ {
const char* nodeName = node->Attribute("id"); //const char* nodeName = node->Attribute("id");
//printf("processing node %s\n", nodeName); //printf("processing node %s\n", nodeName);

View File

@@ -157,7 +157,6 @@ struct BulletMJCFImporterInternalData
//rudimentary 'default' support, would need more work for better feature coverage //rudimentary 'default' support, would need more work for better feature coverage
for (TiXmlElement* child_xml = root_xml->FirstChildElement() ; child_xml ; child_xml = child_xml->NextSiblingElement()) for (TiXmlElement* child_xml = root_xml->FirstChildElement() ; child_xml ; child_xml = child_xml->NextSiblingElement())
{ {
bool handled = false;
std::string n = child_xml->Value(); std::string n = child_xml->Value();
if (n=="inertial") if (n=="inertial")
{ {
@@ -412,7 +411,7 @@ struct BulletMJCFImporterInternalData
const char* rgba = link_xml->Attribute("rgba"); // const char* rgba = link_xml->Attribute("rgba");
const char* gType = link_xml->Attribute("type"); const char* gType = link_xml->Attribute("type");
const char* sz = link_xml->Attribute("size"); const char* sz = link_xml->Attribute("size");
const char* posS = link_xml->Attribute("pos"); const char* posS = link_xml->Attribute("pos");
@@ -713,7 +712,7 @@ struct BulletMJCFImporterInternalData
const char* bodyName = link_xml->Attribute("name"); const char* bodyName = link_xml->Attribute("name");
int orgChildLinkIndex = createBody(modelIndex,bodyName); int orgChildLinkIndex = createBody(modelIndex,bodyName);
int curChildLinkIndex = orgChildLinkIndex; // int curChildLinkIndex = orgChildLinkIndex;
std::string bodyN; std::string bodyN;
if (bodyName) if (bodyName)
@@ -727,7 +726,7 @@ struct BulletMJCFImporterInternalData
} }
btTransform orgLinkTransform = parseTransform(link_xml,logger); // btTransform orgLinkTransform = parseTransform(link_xml,logger);
btTransform linkTransform = parseTransform(link_xml,logger); btTransform linkTransform = parseTransform(link_xml,logger);
UrdfLink* linkPtr = getLink(modelIndex,orgChildLinkIndex); UrdfLink* linkPtr = getLink(modelIndex,orgChildLinkIndex);
@@ -739,7 +738,7 @@ struct BulletMJCFImporterInternalData
btQuaternion inertialOrn(0,0,0,1); btQuaternion inertialOrn(0,0,0,1);
btScalar mass = 0.f; btScalar mass = 0.f;
btVector3 localInertiaDiag(0,0,0); btVector3 localInertiaDiag(0,0,0);
int thisLinkIndex = -2; // int thisLinkIndex = -2;
bool hasJoint = false; bool hasJoint = false;
btTransform jointTrans; btTransform jointTrans;
jointTrans.setIdentity(); jointTrans.setIdentity();
@@ -1331,7 +1330,7 @@ class btCompoundShape* BulletMJCFImporter::convertLinkCollisionShapes(int linkIn
btVector3 f = col->m_geometry.m_capsuleFrom; btVector3 f = col->m_geometry.m_capsuleFrom;
btVector3 t = col->m_geometry.m_capsuleTo; btVector3 t = col->m_geometry.m_capsuleTo;
//MuJoCo seems to take the average of the spheres as center? //MuJoCo seems to take the average of the spheres as center?
btVector3 c = (f+t)*0.5; //btVector3 c = (f+t)*0.5;
//f-=c; //f-=c;
//t-=c; //t-=c;
btVector3 fromto[2] = {f,t}; btVector3 fromto[2] = {f,t};

View File

@@ -147,25 +147,8 @@ ImportMJCFSetup::~ImportMJCFSetup()
delete m_data; delete m_data;
} }
static btVector4 colors[4] =
{
btVector4(1,0,0,1),
btVector4(0,1,0,1),
btVector4(0,1,1,1),
btVector4(1,1,0,1),
};
static btVector3 selectColor()
{
static int curColor = 0;
btVector4 color = colors[curColor];
curColor++;
curColor&=3;
return color;
}
void ImportMJCFSetup::setFileName(const char* mjcfFileName) void ImportMJCFSetup::setFileName(const char* mjcfFileName)
{ {
memcpy(m_fileName,mjcfFileName,strlen(mjcfFileName)+1); memcpy(m_fileName,mjcfFileName,strlen(mjcfFileName)+1);
@@ -229,7 +212,7 @@ void ImportMJCFSetup::initPhysics()
//todo: move these internal API called inside the 'ConvertURDF2Bullet' call, hidden from the user //todo: move these internal API called inside the 'ConvertURDF2Bullet' call, hidden from the user
int rootLinkIndex = importer.getRootLinkIndex(); //int rootLinkIndex = importer.getRootLinkIndex();
//b3Printf("urdf root link index = %d\n",rootLinkIndex); //b3Printf("urdf root link index = %d\n",rootLinkIndex);
MyMultiBodyCreator creation(m_guiHelper); MyMultiBodyCreator creation(m_guiHelper);

View File

@@ -30,7 +30,7 @@ bool b3ImportMeshUtility::loadAndRegisterMeshFromFileInternal(const std::string&
GLInstanceGraphicsShape* gfxShape = btgCreateGraphicsShapeFromWavefrontObj(shapes); GLInstanceGraphicsShape* gfxShape = btgCreateGraphicsShapeFromWavefrontObj(shapes);
int textureIndex = -1; //int textureIndex = -1;
//try to load some texture //try to load some texture
for (int i=0;i<shapes.size();i++) for (int i=0;i<shapes.size();i++)
{ {

View File

@@ -155,25 +155,8 @@ ImportSDFSetup::~ImportSDFSetup()
delete m_data; delete m_data;
} }
static btVector4 colors[4] =
{
btVector4(1,0,0,1),
btVector4(0,1,0,1),
btVector4(0,1,1,1),
btVector4(1,1,0,1),
};
static btVector3 selectColor()
{
static int curColor = 0;
btVector4 color = colors[curColor];
curColor++;
curColor&=3;
return color;
}
void ImportSDFSetup::setFileName(const char* urdfFileName) void ImportSDFSetup::setFileName(const char* urdfFileName)
{ {
memcpy(m_fileName,urdfFileName,strlen(urdfFileName)+1); memcpy(m_fileName,urdfFileName,strlen(urdfFileName)+1);
@@ -227,7 +210,7 @@ void ImportSDFSetup::initPhysics()
//todo: move these internal API called inside the 'ConvertURDF2Bullet' call, hidden from the user //todo: move these internal API called inside the 'ConvertURDF2Bullet' call, hidden from the user
int rootLinkIndex = u2b.getRootLinkIndex(); //int rootLinkIndex = u2b.getRootLinkIndex();
//b3Printf("urdf root link index = %d\n",rootLinkIndex); //b3Printf("urdf root link index = %d\n",rootLinkIndex);
MyMultiBodyCreator creation(m_guiHelper); MyMultiBodyCreator creation(m_guiHelper);

View File

@@ -159,25 +159,8 @@ ImportUrdfSetup::~ImportUrdfSetup()
delete m_data; delete m_data;
} }
static btVector4 colors[4] =
{
btVector4(1,0,0,1),
btVector4(0,1,0,1),
btVector4(0,1,1,1),
btVector4(1,1,0,1),
};
static btVector3 selectColor()
{
static int curColor = 0;
btVector4 color = colors[curColor];
curColor++;
curColor&=3;
return color;
}
void ImportUrdfSetup::setFileName(const char* urdfFileName) void ImportUrdfSetup::setFileName(const char* urdfFileName)
{ {
memcpy(m_fileName,urdfFileName,strlen(urdfFileName)+1); memcpy(m_fileName,urdfFileName,strlen(urdfFileName)+1);
@@ -237,7 +220,7 @@ void ImportUrdfSetup::initPhysics()
//todo: move these internal API called inside the 'ConvertURDF2Bullet' call, hidden from the user //todo: move these internal API called inside the 'ConvertURDF2Bullet' call, hidden from the user
int rootLinkIndex = u2b.getRootLinkIndex(); //int rootLinkIndex = u2b.getRootLinkIndex();
//b3Printf("urdf root link index = %d\n",rootLinkIndex); //b3Printf("urdf root link index = %d\n",rootLinkIndex);
MyMultiBodyCreator creation(m_guiHelper); MyMultiBodyCreator creation(m_guiHelper);

View File

@@ -11,8 +11,8 @@
#include "MultiBodyCreationInterface.h" #include "MultiBodyCreationInterface.h"
#include <string> #include <string>
static int bodyCollisionFilterGroup=btBroadphaseProxy::CharacterFilter; //static int bodyCollisionFilterGroup=btBroadphaseProxy::CharacterFilter;
static int bodyCollisionFilterMask=btBroadphaseProxy::AllFilter&(~btBroadphaseProxy::CharacterFilter); //static int bodyCollisionFilterMask=btBroadphaseProxy::AllFilter&(~btBroadphaseProxy::CharacterFilter);
static bool enableConstraints = true; static bool enableConstraints = true;
static btVector4 colors[4] = static btVector4 colors[4] =
@@ -446,8 +446,8 @@ void ConvertURDF2BulletInternal(
//base and fixed? -> static, otherwise flag as dynamic //base and fixed? -> static, otherwise flag as dynamic
bool isDynamic = (mbLinkIndex<0 && cache.m_bulletMultiBody->hasFixedBase())? false : true; bool isDynamic = (mbLinkIndex<0 && cache.m_bulletMultiBody->hasFixedBase())? false : true;
short collisionFilterGroup = isDynamic? short(btBroadphaseProxy::DefaultFilter) : short(btBroadphaseProxy::StaticFilter); int collisionFilterGroup = isDynamic? int(btBroadphaseProxy::DefaultFilter) : int(btBroadphaseProxy::StaticFilter);
short collisionFilterMask = isDynamic? short(btBroadphaseProxy::AllFilter) : short(btBroadphaseProxy::AllFilter ^ btBroadphaseProxy::StaticFilter); int collisionFilterMask = isDynamic? int(btBroadphaseProxy::AllFilter) : int(btBroadphaseProxy::AllFilter ^ btBroadphaseProxy::StaticFilter);
int colGroup=0, colMask=0; int colGroup=0, colMask=0;
int flags = u2b.getCollisionGroupAndMask(urdfLinkIndex,colGroup, colMask); int flags = u2b.getCollisionGroupAndMask(urdfLinkIndex,colGroup, colMask);

View File

@@ -225,13 +225,13 @@ void InverseDynamicsExample::initPhysics()
{ {
qd[dof] = 0; qd[dof] = 0;
char tmp[25]; char tmp[25];
sprintf(tmp,"q_desired[%u]",dof); sprintf(tmp,"q_desired[%lu]",dof);
qd_name[dof] = tmp; qd_name[dof] = tmp;
SliderParams slider(qd_name[dof].c_str(),&qd[dof]); SliderParams slider(qd_name[dof].c_str(),&qd[dof]);
slider.m_minVal=-3.14; slider.m_minVal=-3.14;
slider.m_maxVal=3.14; slider.m_maxVal=3.14;
sprintf(tmp,"q[%u]",dof); sprintf(tmp,"q[%lu]",dof);
q_name[dof] = tmp; q_name[dof] = tmp;
m_guiHelper->getParameterInterface()->registerSliderFloatParameter(slider); m_guiHelper->getParameterInterface()->registerSliderFloatParameter(slider);
btVector4 color = sJointCurveColors[dof&7]; btVector4 color = sJointCurveColors[dof&7];
@@ -343,6 +343,7 @@ void InverseDynamicsExample::stepSimulation(float deltaTime)
btAlignedObjectArray<btQuaternion> scratch_q; btAlignedObjectArray<btQuaternion> scratch_q;
btAlignedObjectArray<btVector3> scratch_m; btAlignedObjectArray<btVector3> scratch_m;
m_multiBody->forwardKinematics(scratch_q, scratch_m); m_multiBody->forwardKinematics(scratch_q, scratch_m);
#if 0
for (int i = 0; i < m_multiBody->getNumLinks(); i++) for (int i = 0; i < m_multiBody->getNumLinks(); i++)
{ {
//btVector3 pos = m_multiBody->getLink(i).m_cachedWorldTransform.getOrigin(); //btVector3 pos = m_multiBody->getLink(i).m_cachedWorldTransform.getOrigin();
@@ -355,6 +356,7 @@ void InverseDynamicsExample::stepSimulation(float deltaTime)
} }
#endif
} }
} }

View File

@@ -155,10 +155,7 @@ class InverseKinematicsExample : public CommonExampleInterface
b3AlignedObjectArray<Node*> m_ikNodes; b3AlignedObjectArray<Node*> m_ikNodes;
Jacobian* m_ikJacobian; Jacobian* m_ikJacobian;
float m_x; b3AlignedObjectArray<int> m_movingInstances;
float m_y;
float m_z;
b3AlignedObjectArray<int> m_movingInstances;
int m_targetInstance; int m_targetInstance;
enum enum
{ {
@@ -169,12 +166,9 @@ public:
InverseKinematicsExample(CommonGraphicsApp* app, int option) InverseKinematicsExample(CommonGraphicsApp* app, int option)
:m_app(app), :m_app(app),
m_x(0), m_ikMethod(option),
m_y(0), m_targetInstance(-1)
m_z(0), {
m_targetInstance(-1),
m_ikMethod(option)
{
m_app->setUpAxis(2); m_app->setUpAxis(2);
{ {
@@ -336,7 +330,7 @@ public:
void InverseKinematicsExample::BuildKukaIIWAShape() void InverseKinematicsExample::BuildKukaIIWAShape()
{ {
const VectorR3& unitx = VectorR3::UnitX; //const VectorR3& unitx = VectorR3::UnitX;
const VectorR3& unity = VectorR3::UnitY; const VectorR3& unity = VectorR3::UnitY;
const VectorR3& unitz = VectorR3::UnitZ; const VectorR3& unitz = VectorR3::UnitZ;
const VectorR3 unit1(sqrt(14.0) / 8.0, 1.0 / 8.0, 7.0 / 8.0); const VectorR3 unit1(sqrt(14.0) / 8.0, 1.0 / 8.0, 7.0 / 8.0);

View File

@@ -211,11 +211,11 @@ btMultiBody* createInvertedPendulumMultiBody(btMultiBodyDynamicsWorld* world, GU
local_origin.resize(pMultiBody->getNumLinks() + 1); local_origin.resize(pMultiBody->getNumLinks() + 1);
world_to_local[0] = pMultiBody->getWorldToBaseRot(); world_to_local[0] = pMultiBody->getWorldToBaseRot();
local_origin[0] = pMultiBody->getBasePos(); local_origin[0] = pMultiBody->getBasePos();
double friction = 1; // double friction = 1;
{ {
// float pos[4]={local_origin[0].x(),local_origin[0].y(),local_origin[0].z(),1}; // float pos[4]={local_origin[0].x(),local_origin[0].y(),local_origin[0].z(),1};
float quat[4]={-world_to_local[0].x(),-world_to_local[0].y(),-world_to_local[0].z(),world_to_local[0].w()}; // float quat[4]={-world_to_local[0].x(),-world_to_local[0].y(),-world_to_local[0].z(),world_to_local[0].w()};
if (1) if (1)
@@ -238,8 +238,8 @@ btMultiBody* createInvertedPendulumMultiBody(btMultiBodyDynamicsWorld* world, GU
col->setWorldTransform(tr); col->setWorldTransform(tr);
bool isDynamic = (baseMass > 0 && !fixedBase); bool isDynamic = (baseMass > 0 && !fixedBase);
short collisionFilterGroup = isDynamic? short(btBroadphaseProxy::DefaultFilter) : short(btBroadphaseProxy::StaticFilter); int collisionFilterGroup = isDynamic? int(btBroadphaseProxy::DefaultFilter) : int(btBroadphaseProxy::StaticFilter);
short collisionFilterMask = isDynamic? short(btBroadphaseProxy::AllFilter) : short(btBroadphaseProxy::AllFilter ^ btBroadphaseProxy::StaticFilter); int collisionFilterMask = isDynamic? int(btBroadphaseProxy::AllFilter) : int(btBroadphaseProxy::AllFilter ^ btBroadphaseProxy::StaticFilter);
world->addCollisionObject(col,collisionFilterGroup,collisionFilterMask);//, 2,1+2); world->addCollisionObject(col,collisionFilterGroup,collisionFilterMask);//, 2,1+2);
@@ -291,8 +291,8 @@ btMultiBody* createInvertedPendulumMultiBody(btMultiBodyDynamicsWorld* world, GU
col->setWorldTransform(tr); col->setWorldTransform(tr);
// col->setFriction(friction); // col->setFriction(friction);
bool isDynamic = 1;//(linkMass > 0); bool isDynamic = 1;//(linkMass > 0);
short collisionFilterGroup = isDynamic? short(btBroadphaseProxy::DefaultFilter) : short(btBroadphaseProxy::StaticFilter); int collisionFilterGroup = isDynamic? int(btBroadphaseProxy::DefaultFilter) : int(btBroadphaseProxy::StaticFilter);
short collisionFilterMask = isDynamic? short(btBroadphaseProxy::AllFilter) : short(btBroadphaseProxy::AllFilter ^ btBroadphaseProxy::StaticFilter); int collisionFilterMask = isDynamic? int(btBroadphaseProxy::AllFilter) : int(btBroadphaseProxy::AllFilter ^ btBroadphaseProxy::StaticFilter);
//if (i==0||i>numLinks-2) //if (i==0||i>numLinks-2)
{ {
@@ -450,7 +450,7 @@ void InvertedPendulumPDControl::stepSimulation(float deltaTime)
m_multiBody->getBaseOmega()[2] m_multiBody->getBaseOmega()[2]
); );
*/ */
btScalar jointVel =m_multiBody->getJointVel(0); // btScalar jointVel =m_multiBody->getJointVel(0);
// b3Printf("child angvel = %f",jointVel); // b3Printf("child angvel = %f",jointVel);

View File

@@ -91,7 +91,7 @@ void MultiBodyConstraintFeedbackSetup::initPhysics()
m_guiHelper->createCollisionShapeGraphicsObject(box); m_guiHelper->createCollisionShapeGraphicsObject(box);
btTransform start; start.setIdentity(); btTransform start; start.setIdentity();
btVector3 groundOrigin(-0.4f, 3.f, 0.f); btVector3 groundOrigin(-0.4f, 3.f, 0.f);
btVector3 basePosition = btVector3(-0.4f, 3.f, 0.f); //btVector3 basePosition = btVector3(-0.4f, 3.f, 0.f);
groundOrigin[upAxis] -=.5; groundOrigin[upAxis] -=.5;
groundOrigin[2]-=0.6; groundOrigin[2]-=0.6;
start.setOrigin(groundOrigin); start.setOrigin(groundOrigin);
@@ -263,11 +263,11 @@ void MultiBodyConstraintFeedbackSetup::initPhysics()
local_origin.resize(pMultiBody->getNumLinks() + 1); local_origin.resize(pMultiBody->getNumLinks() + 1);
world_to_local[0] = pMultiBody->getWorldToBaseRot(); world_to_local[0] = pMultiBody->getWorldToBaseRot();
local_origin[0] = pMultiBody->getBasePos(); local_origin[0] = pMultiBody->getBasePos();
double friction = 1; // double friction = 1;
{ {
// float pos[4]={local_origin[0].x(),local_origin[0].y(),local_origin[0].z(),1}; // float pos[4]={local_origin[0].x(),local_origin[0].y(),local_origin[0].z(),1};
float quat[4]={-world_to_local[0].x(),-world_to_local[0].y(),-world_to_local[0].z(),world_to_local[0].w()}; // float quat[4]={-world_to_local[0].x(),-world_to_local[0].y(),-world_to_local[0].z(),world_to_local[0].w()};
if (1) if (1)
@@ -290,8 +290,8 @@ void MultiBodyConstraintFeedbackSetup::initPhysics()
col->setWorldTransform(tr); col->setWorldTransform(tr);
bool isDynamic = (baseMass > 0 && floating); bool isDynamic = (baseMass > 0 && floating);
short collisionFilterGroup = isDynamic? short(btBroadphaseProxy::DefaultFilter) : short(btBroadphaseProxy::StaticFilter); int collisionFilterGroup = isDynamic? int(btBroadphaseProxy::DefaultFilter) : int(btBroadphaseProxy::StaticFilter);
short collisionFilterMask = isDynamic? short(btBroadphaseProxy::AllFilter) : short(btBroadphaseProxy::AllFilter ^ btBroadphaseProxy::StaticFilter); int collisionFilterMask = isDynamic? int(btBroadphaseProxy::AllFilter) : int(btBroadphaseProxy::AllFilter ^ btBroadphaseProxy::StaticFilter);
world->addCollisionObject(col,collisionFilterGroup,collisionFilterMask);//, 2,1+2); world->addCollisionObject(col,collisionFilterGroup,collisionFilterMask);//, 2,1+2);
@@ -343,8 +343,8 @@ void MultiBodyConstraintFeedbackSetup::initPhysics()
col->setWorldTransform(tr); col->setWorldTransform(tr);
// col->setFriction(friction); // col->setFriction(friction);
bool isDynamic = 1;//(linkMass > 0); bool isDynamic = 1;//(linkMass > 0);
short collisionFilterGroup = isDynamic? short(btBroadphaseProxy::DefaultFilter) : short(btBroadphaseProxy::StaticFilter); int collisionFilterGroup = isDynamic? int(btBroadphaseProxy::DefaultFilter) : int(btBroadphaseProxy::StaticFilter);
short collisionFilterMask = isDynamic? short(btBroadphaseProxy::AllFilter) : short(btBroadphaseProxy::AllFilter ^ btBroadphaseProxy::StaticFilter); int collisionFilterMask = isDynamic? int(btBroadphaseProxy::AllFilter) : int(btBroadphaseProxy::AllFilter ^ btBroadphaseProxy::StaticFilter);
//if (i==0||i>numLinks-2) //if (i==0||i>numLinks-2)
{ {
@@ -416,7 +416,7 @@ void MultiBodyConstraintFeedbackSetup::stepSimulation(float deltaTime)
m_multiBody->getBaseOmega()[2] m_multiBody->getBaseOmega()[2]
); );
*/ */
btScalar jointVel =m_multiBody->getJointVel(0); // btScalar jointVel =m_multiBody->getJointVel(0);
// b3Printf("child angvel = %f",jointVel); // b3Printf("child angvel = %f",jointVel);

View File

@@ -7,7 +7,7 @@
#include "../CommonInterfaces/CommonMultiBodyBase.h" #include "../CommonInterfaces/CommonMultiBodyBase.h"
#include "../Utils/b3ResourcePath.h" #include "../Utils/b3ResourcePath.h"
static btScalar radius(0.2); //static btScalar radius(0.2);
struct MultiBodySoftContact : public CommonMultiBodyBase struct MultiBodySoftContact : public CommonMultiBodyBase
{ {
@@ -126,8 +126,8 @@ void MultiBodySoftContact::initPhysics()
col->setCollisionShape(childShape); col->setCollisionShape(childShape);
pMultiBody->setBaseCollider(col); pMultiBody->setBaseCollider(col);
bool isDynamic = (mass > 0 && !isFixed); bool isDynamic = (mass > 0 && !isFixed);
short collisionFilterGroup = isDynamic? short(btBroadphaseProxy::DefaultFilter) : short(btBroadphaseProxy::StaticFilter); int collisionFilterGroup = isDynamic? int(btBroadphaseProxy::DefaultFilter) : int(btBroadphaseProxy::StaticFilter);
short collisionFilterMask = isDynamic? short(btBroadphaseProxy::AllFilter) : short(btBroadphaseProxy::AllFilter ^ btBroadphaseProxy::StaticFilter); int collisionFilterMask = isDynamic? int(btBroadphaseProxy::AllFilter) : int(btBroadphaseProxy::AllFilter ^ btBroadphaseProxy::StaticFilter);
m_dynamicsWorld->addCollisionObject(col,collisionFilterGroup,collisionFilterMask);//, 2,1+2); m_dynamicsWorld->addCollisionObject(col,collisionFilterGroup,collisionFilterMask);//, 2,1+2);

View File

@@ -242,7 +242,7 @@ void MultiDofDemo::initPhysics()
if (multibodyConstraint) { if (multibodyConstraint) {
btVector3 pointInA = -linkHalfExtents; btVector3 pointInA = -linkHalfExtents;
btVector3 pointInB = halfExtents; // btVector3 pointInB = halfExtents;
btMatrix3x3 frameInA; btMatrix3x3 frameInA;
btMatrix3x3 frameInB; btMatrix3x3 frameInB;
frameInA.setIdentity(); frameInA.setIdentity();

View File

@@ -150,8 +150,8 @@ void Pendulum::initPhysics()
btMultiBodyLinkCollider* col = new btMultiBodyLinkCollider(pMultiBody, i); btMultiBodyLinkCollider* col = new btMultiBodyLinkCollider(pMultiBody, i);
col->setCollisionShape(shape); col->setCollisionShape(shape);
bool isDynamic = 1; bool isDynamic = 1;
short collisionFilterGroup = isDynamic? short(btBroadphaseProxy::DefaultFilter) : short(btBroadphaseProxy::StaticFilter); int collisionFilterGroup = isDynamic? int(btBroadphaseProxy::DefaultFilter) : int(btBroadphaseProxy::StaticFilter);
short collisionFilterMask = isDynamic? short(btBroadphaseProxy::AllFilter) : short(btBroadphaseProxy::AllFilter ^ btBroadphaseProxy::StaticFilter); int collisionFilterMask = isDynamic? int(btBroadphaseProxy::AllFilter) : int(btBroadphaseProxy::AllFilter ^ btBroadphaseProxy::StaticFilter);
world->addCollisionObject(col,collisionFilterGroup,collisionFilterMask);//,2,1+2); world->addCollisionObject(col,collisionFilterGroup,collisionFilterMask);//,2,1+2);
btVector4 color(1,0,0,1); btVector4 color(1,0,0,1);
m_guiHelper->createCollisionObjectGraphicsObject(col,color); m_guiHelper->createCollisionObjectGraphicsObject(col,color);

View File

@@ -294,8 +294,8 @@ void TestJointTorqueSetup::initPhysics()
col->setWorldTransform(tr); col->setWorldTransform(tr);
bool isDynamic = (baseMass > 0 && floating); bool isDynamic = (baseMass > 0 && floating);
short collisionFilterGroup = isDynamic? short(btBroadphaseProxy::DefaultFilter) : short(btBroadphaseProxy::StaticFilter); int collisionFilterGroup = isDynamic? int(btBroadphaseProxy::DefaultFilter) : int(btBroadphaseProxy::StaticFilter);
short collisionFilterMask = isDynamic? short(btBroadphaseProxy::AllFilter) : short(btBroadphaseProxy::AllFilter ^ btBroadphaseProxy::StaticFilter); int collisionFilterMask = isDynamic? int(btBroadphaseProxy::AllFilter) : int(btBroadphaseProxy::AllFilter ^ btBroadphaseProxy::StaticFilter);
world->addCollisionObject(col,collisionFilterGroup,collisionFilterMask);//, 2,1+2); world->addCollisionObject(col,collisionFilterGroup,collisionFilterMask);//, 2,1+2);
@@ -347,8 +347,8 @@ void TestJointTorqueSetup::initPhysics()
col->setWorldTransform(tr); col->setWorldTransform(tr);
// col->setFriction(friction); // col->setFriction(friction);
bool isDynamic = 1;//(linkMass > 0); bool isDynamic = 1;//(linkMass > 0);
short collisionFilterGroup = isDynamic? short(btBroadphaseProxy::DefaultFilter) : short(btBroadphaseProxy::StaticFilter); int collisionFilterGroup = isDynamic? int(btBroadphaseProxy::DefaultFilter) : int(btBroadphaseProxy::StaticFilter);
short collisionFilterMask = isDynamic? short(btBroadphaseProxy::AllFilter) : short(btBroadphaseProxy::AllFilter ^ btBroadphaseProxy::StaticFilter); int collisionFilterMask = isDynamic? int(btBroadphaseProxy::AllFilter) : int(btBroadphaseProxy::AllFilter ^ btBroadphaseProxy::StaticFilter);
//if (i==0||i>numLinks-2) //if (i==0||i>numLinks-2)
{ {

View File

@@ -224,12 +224,12 @@ private:
extern TaskManager gTaskMgr; extern TaskManager gTaskMgr;
static void initTaskScheduler() inline static void initTaskScheduler()
{ {
gTaskMgr.init(); gTaskMgr.init();
} }
static void cleanupTaskScheduler() inline static void cleanupTaskScheduler()
{ {
gTaskMgr.shutdown(); gTaskMgr.shutdown();
} }

View File

@@ -163,8 +163,6 @@ void* SamplelsMemoryFunc()
class MultiThreadingExample : public CommonExampleInterface class MultiThreadingExample : public CommonExampleInterface
{ {
CommonGraphicsApp* m_app; CommonGraphicsApp* m_app;
GUIHelperInterface* m_guiHelper;
int m_exampleIndex;
b3ThreadSupportInterface* m_threadSupport; b3ThreadSupportInterface* m_threadSupport;
btAlignedObjectArray<SampleJob1*> m_jobs; btAlignedObjectArray<SampleJob1*> m_jobs;
int m_numThreads; int m_numThreads;
@@ -172,12 +170,10 @@ public:
MultiThreadingExample(GUIHelperInterface* guiHelper, int tutorialIndex) MultiThreadingExample(GUIHelperInterface* guiHelper, int tutorialIndex)
:m_app(guiHelper->getAppInterface()), :m_app(guiHelper->getAppInterface()),
m_guiHelper(guiHelper),
m_exampleIndex(tutorialIndex),
m_threadSupport(0), m_threadSupport(0),
m_numThreads(8) m_numThreads(8)
{ {
int numBodies = 1; //int numBodies = 1;
m_app->setUpAxis(1); m_app->setUpAxis(1);
m_app->m_renderer->enableBlend(true); m_app->m_renderer->enableBlend(true);

View File

@@ -43,8 +43,8 @@ struct CommonOpenCLBase : public CommonExampleInterface
virtual void initCL(int preferredDeviceIndex, int preferredPlatformIndex) virtual void initCL(int preferredDeviceIndex, int preferredPlatformIndex)
{ {
void* glCtx=0; // void* glCtx=0;
void* glDC = 0; // void* glDC = 0;

View File

@@ -208,9 +208,6 @@ void PairBench::initPhysics()
useShadowMap = false; useShadowMap = false;
int startItem = 0;
initCL(gPreferredOpenCLDeviceIndex,gPreferredOpenCLPlatformIndex); initCL(gPreferredOpenCLDeviceIndex,gPreferredOpenCLPlatformIndex);
if (m_clData->m_clContext) if (m_clData->m_clContext)
@@ -298,7 +295,7 @@ void PairBench::createBroadphase(int arraySizeX, int arraySizeY, int arraySizeZ)
char * patloc; char * patloc;
for (oriptr = buf; patloc = strstr(oriptr, pattern); oriptr = patloc + patlen) for (oriptr = buf; (patloc = strstr(oriptr, pattern)); oriptr = patloc + patlen)
{ {
if (patloc) if (patloc)
{ {
@@ -335,12 +332,14 @@ void PairBench::createBroadphase(int arraySizeX, int arraySizeY, int arraySizeZ)
if (l>500) if (l>500)
{ {
b3Vector4 color=b3MakeVector4(0,1,0,0.1); b3Vector4 color=b3MakeVector4(0,1,0,0.1);
int id = m_guiHelper->getRenderInterface()->registerGraphicsInstance(shapeId,position,orn,color,scaling); int id;
id = m_guiHelper->getRenderInterface()->registerGraphicsInstance(shapeId,position,orn,color,scaling);
m_data->m_broadphaseGPU->createLargeProxy(aabbMin,aabbMax,index,group,mask); m_data->m_broadphaseGPU->createLargeProxy(aabbMin,aabbMax,index,group,mask);
} else } else
{ {
b3Vector4 color=b3MakeVector4(1,0,0,1); b3Vector4 color=b3MakeVector4(1,0,0,1);
int id = m_guiHelper->getRenderInterface()->registerGraphicsInstance(shapeId,position,orn,color,scaling); int id;
id = m_guiHelper->getRenderInterface()->registerGraphicsInstance(shapeId,position,orn,color,scaling);
m_data->m_broadphaseGPU->createProxy(aabbMin,aabbMax,index,group,mask); m_data->m_broadphaseGPU->createProxy(aabbMin,aabbMax,index,group,mask);
index++; index++;
} }
@@ -403,7 +402,8 @@ void PairBench::createBroadphase(int arraySizeX, int arraySizeY, int arraySizeZ)
}*/ }*/
int id = m_guiHelper->getRenderInterface()->registerGraphicsInstance(shapeId,position,orn,color,scaling); int id;
id = m_guiHelper->getRenderInterface()->registerGraphicsInstance(shapeId,position,orn,color,scaling);
b3Vector3 aabbMin = position-scaling; b3Vector3 aabbMin = position-scaling;
@@ -486,7 +486,7 @@ void PairBench::stepSimulation(float deltaTime)
return; return;
bool animate=true; //bool animate=true;
int numObjects= 0; int numObjects= 0;
{ {
B3_PROFILE("Num Objects"); B3_PROFILE("Num Objects");
@@ -503,7 +503,7 @@ void PairBench::stepSimulation(float deltaTime)
int arraySizeInBytes = numObjects * (3)*sizeof(b3Vector4); int arraySizeInBytes = numObjects * (3)*sizeof(b3Vector4);
glBindBuffer(GL_ARRAY_BUFFER, vbo); glBindBuffer(GL_ARRAY_BUFFER, vbo);
cl_bool blocking= CL_TRUE; // cl_bool blocking= CL_TRUE;
char* hostPtr= 0; char* hostPtr= 0;
{ {
B3_PROFILE("glMapBufferRange"); B3_PROFILE("glMapBufferRange");
@@ -583,7 +583,7 @@ void PairBench::stepSimulation(float deltaTime)
B3_PROFILE("updateOnCpu"); B3_PROFILE("updateOnCpu");
if (!gPairBenchFileName) if (!gPairBenchFileName)
{ {
int allAabbs = m_data->m_broadphaseGPU->getAllAabbsCPU().size(); // int allAabbs = m_data->m_broadphaseGPU->getAllAabbsCPU().size();
b3AlignedObjectArray<b3Vector4> posOrnColorsCpu; b3AlignedObjectArray<b3Vector4> posOrnColorsCpu;
@@ -625,11 +625,12 @@ void PairBench::stepSimulation(float deltaTime)
b3Clock cl; b3Clock cl;
dt = cl.getTimeMicroseconds(); dt = cl.getTimeMicroseconds();
B3_PROFILE("calculateOverlappingPairs"); B3_PROFILE("calculateOverlappingPairs");
int sz = sizeof(b3Int4)*64*numObjects; //int sz = sizeof(b3Int4)*64*numObjects;
m_data->m_broadphaseGPU->calculateOverlappingPairs(maxOverlap); m_data->m_broadphaseGPU->calculateOverlappingPairs(maxOverlap);
int numPairs = m_data->m_broadphaseGPU->getNumOverlap(); int numPairs;
numPairs = m_data->m_broadphaseGPU->getNumOverlap();
//printf("numPairs = %d\n", numPairs); //printf("numPairs = %d\n", numPairs);
dt = cl.getTimeMicroseconds()-dt; dt = cl.getTimeMicroseconds()-dt;

View File

@@ -223,8 +223,8 @@ int GpuConvexScene::createDynamicsObjects2( const float* vertices, int numVertic
} }
int shapeId = m_guiHelper->getRenderInterface()->registerShape(&vertices[0],numVertices,indices,numIndices,B3_GL_TRIANGLES,textureIndex); int shapeId = m_guiHelper->getRenderInterface()->registerShape(&vertices[0],numVertices,indices,numIndices,B3_GL_TRIANGLES,textureIndex);
int group=1; //int group=1;
int mask=1; //int mask=1;
int index=0; int index=0;
@@ -237,7 +237,7 @@ int GpuConvexScene::createDynamicsObjects2( const float* vertices, int numVertic
int curColor = 0; int curColor = 0;
float scaling[4] = {1,1,1,1}; float scaling[4] = {1,1,1,1};
int prevBody = -1; int prevBody = -1;
int insta = 0; //int insta = 0;
b3ConvexUtility* utilPtr = new b3ConvexUtility(); b3ConvexUtility* utilPtr = new b3ConvexUtility();
@@ -290,9 +290,11 @@ int GpuConvexScene::createDynamicsObjects2( const float* vertices, int numVertic
b3Vector4 color = colors[curColor]; b3Vector4 color = colors[curColor];
curColor++; curColor++;
curColor&=3; curColor&=3;
b3Vector4 scalin=b3MakeVector4(1,1,1,1); // b3Vector4 scaling=b3MakeVector4(1,1,1,1);
int id = m_guiHelper->getRenderInterface()->registerGraphicsInstance(shapeId,position,orn,color,scaling); int id;
int pid = m_data->m_rigidBodyPipeline->registerPhysicsInstance(mass,position,orn,colIndex,index,false); id= m_guiHelper->getRenderInterface()->registerGraphicsInstance(shapeId,position,orn,color,scaling);
int pid;
pid = m_data->m_rigidBodyPipeline->registerPhysicsInstance(mass,position,orn,colIndex,index,false);
if (prevBody>=0) if (prevBody>=0)
@@ -319,8 +321,8 @@ void GpuConvexScene::createStaticEnvironment()
int numIndices = sizeof(cube_indices)/sizeof(int); int numIndices = sizeof(cube_indices)/sizeof(int);
//int shapeId = ci.m_instancingRenderer->registerShape(&cube_vertices[0],numVertices,cube_indices,numIndices); //int shapeId = ci.m_instancingRenderer->registerShape(&cube_vertices[0],numVertices,cube_indices,numIndices);
int shapeId = m_instancingRenderer->registerShape(&cube_vertices[0],numVertices,cube_indices,numIndices); int shapeId = m_instancingRenderer->registerShape(&cube_vertices[0],numVertices,cube_indices,numIndices);
int group=1; //int group=1;
int mask=1; //int mask=1;
int index=0; int index=0;
@@ -332,8 +334,10 @@ void GpuConvexScene::createStaticEnvironment()
b3Vector4 color=b3MakeVector4(0,0,1,1); b3Vector4 color=b3MakeVector4(0,0,1,1);
int id = m_instancingRenderer->registerGraphicsInstance(shapeId,position,orn,color,scaling); int id;
int pid = m_data->m_rigidBodyPipeline->registerPhysicsInstance(0.f,position,orn,colIndex,index,false); id = m_instancingRenderer->registerGraphicsInstance(shapeId,position,orn,color,scaling);
int pid;
pid = m_data->m_rigidBodyPipeline->registerPhysicsInstance(0.f,position,orn,colIndex,index,false);
} }
} }
@@ -345,8 +349,8 @@ void GpuConvexPlaneScene::createStaticEnvironment()
int numIndices = sizeof(cube_indices)/sizeof(int); int numIndices = sizeof(cube_indices)/sizeof(int);
//int shapeId = ci.m_instancingRenderer->registerShape(&cube_vertices[0],numVertices,cube_indices,numIndices); //int shapeId = ci.m_instancingRenderer->registerShape(&cube_vertices[0],numVertices,cube_indices,numIndices);
int shapeId = m_guiHelper->getRenderInterface()->registerShape(&cube_vertices[0],numVertices,cube_indices,numIndices); int shapeId = m_guiHelper->getRenderInterface()->registerShape(&cube_vertices[0],numVertices,cube_indices,numIndices);
int group=1; // int group=1;
int mask=1; // int mask=1;
int index=0; int index=0;
@@ -358,8 +362,10 @@ void GpuConvexPlaneScene::createStaticEnvironment()
b3Vector4 color=b3MakeVector4(0,0,1,1); b3Vector4 color=b3MakeVector4(0,0,1,1);
int id = m_guiHelper->getRenderInterface()->registerGraphicsInstance(shapeId,position,orn,color,scaling); int id;
int pid = m_data->m_rigidBodyPipeline->registerPhysicsInstance(0.f,position,orn,colIndex,index,false); id = m_guiHelper->getRenderInterface()->registerGraphicsInstance(shapeId,position,orn,color,scaling);
int pid;
pid = m_data->m_rigidBodyPipeline->registerPhysicsInstance(0.f,position,orn,colIndex,index,false);
} }
@@ -535,8 +541,8 @@ void GpuTetraScene::createFromTetGenData(const char* ele,
int numVertices = sizeof(mytetra_vertices)/strideInBytes; int numVertices = sizeof(mytetra_vertices)/strideInBytes;
int numIndices = sizeof(mytetra_indices)/sizeof(int); int numIndices = sizeof(mytetra_indices)/sizeof(int);
int shapeId = m_instancingRenderer->registerShape(&mytetra_vertices[0],numVertices,mytetra_indices,numIndices); int shapeId = m_instancingRenderer->registerShape(&mytetra_vertices[0],numVertices,mytetra_indices,numIndices);
int group=1; // int group=1;
int mask=1; // int mask=1;
@@ -553,8 +559,10 @@ void GpuTetraScene::createFromTetGenData(const char* ele,
b3Vector4 color = colors[curColor++]; b3Vector4 color = colors[curColor++];
curColor&=3; curColor&=3;
int id = m_instancingRenderer->registerGraphicsInstance(shapeId,position,orn,color,scaling); int id;
int pid = m_data->m_rigidBodyPipeline->registerPhysicsInstance(1.f,position,orn,colIndex,0,false); id = m_instancingRenderer->registerGraphicsInstance(shapeId,position,orn,color,scaling);
int pid;
pid = m_data->m_rigidBodyPipeline->registerPhysicsInstance(1.f,position,orn,colIndex,0,false);
//rigidBodyIds.push_back(pid); //rigidBodyIds.push_back(pid);
} }
@@ -620,7 +628,8 @@ void GpuTetraScene::createFromTetGenData(const char* ele,
bool useGPU = true; bool useGPU = true;
if (useGPU) if (useGPU)
{ {
int cid = m_data->m_rigidBodyPipeline->createFixedConstraint(bodyIndexA,bodyIndexB,pivotInA,pivotInB,relTargetAB,breakingThreshold); int cid;
cid = m_data->m_rigidBodyPipeline->createFixedConstraint(bodyIndexA,bodyIndexB,pivotInA,pivotInB,relTargetAB,breakingThreshold);
} else } else
{ {
b3FixedConstraint* c = new b3FixedConstraint(bodyIndexA,bodyIndexB,frameInA,frameInB); b3FixedConstraint* c = new b3FixedConstraint(bodyIndexA,bodyIndexB,frameInA,frameInB);

View File

@@ -233,7 +233,7 @@ void GpuRigidBodyDemo::stepSimulation(float deltaTime)
GLuint vbo = m_instancingRenderer->getInternalData()->m_vbo; GLuint vbo = m_instancingRenderer->getInternalData()->m_vbo;
int arraySizeInBytes = numObjects * (3)*sizeof(b3Vector4); int arraySizeInBytes = numObjects * (3)*sizeof(b3Vector4);
glBindBuffer(GL_ARRAY_BUFFER, vbo); glBindBuffer(GL_ARRAY_BUFFER, vbo);
cl_bool blocking= CL_TRUE; // cl_bool blocking= CL_TRUE;
positions= (b3Vector4*)glMapBufferRange( GL_ARRAY_BUFFER,m_instancingRenderer->getMaxShapeCapacity(),arraySizeInBytes, GL_MAP_READ_BIT );//GL_READ_WRITE);//GL_WRITE_ONLY positions= (b3Vector4*)glMapBufferRange( GL_ARRAY_BUFFER,m_instancingRenderer->getMaxShapeCapacity(),arraySizeInBytes, GL_MAP_READ_BIT );//GL_READ_WRITE);//GL_WRITE_ONLY
GLint err = glGetError(); GLint err = glGetError();
assert(err==GL_NO_ERROR); assert(err==GL_NO_ERROR);
@@ -296,7 +296,7 @@ void GpuRigidBodyDemo::stepSimulation(float deltaTime)
int arraySizeInBytes = numObjects * (3)*sizeof(b3Vector4); int arraySizeInBytes = numObjects * (3)*sizeof(b3Vector4);
glBindBuffer(GL_ARRAY_BUFFER, vbo); glBindBuffer(GL_ARRAY_BUFFER, vbo);
cl_bool blocking= CL_TRUE; // cl_bool blocking= CL_TRUE;
positions= (b3Vector4*)glMapBufferRange( GL_ARRAY_BUFFER,m_instancingRenderer->getMaxShapeCapacity(),arraySizeInBytes, GL_MAP_WRITE_BIT );//GL_READ_WRITE);//GL_WRITE_ONLY positions= (b3Vector4*)glMapBufferRange( GL_ARRAY_BUFFER,m_instancingRenderer->getMaxShapeCapacity(),arraySizeInBytes, GL_MAP_WRITE_BIT );//GL_READ_WRITE);//GL_WRITE_ONLY
err = glGetError(); err = glGetError();
assert(err==GL_NO_ERROR); assert(err==GL_NO_ERROR);
@@ -329,7 +329,7 @@ b3Vector3 GpuRigidBodyDemo::getRayTo(int x,int y)
float farPlane = 10000.f; float farPlane = 10000.f;
rayForward*= farPlane; rayForward*= farPlane;
b3Vector3 rightOffset; // b3Vector3 rightOffset;
b3Vector3 m_cameraUp=b3MakeVector3(0,1,0); b3Vector3 m_cameraUp=b3MakeVector3(0,1,0);
b3Vector3 vertical = m_cameraUp; b3Vector3 vertical = m_cameraUp;
@@ -401,7 +401,7 @@ bool GpuRigidBodyDemo::mouseMoveCallback(float x,float y)
m_data->m_rigidBodyPipeline->removeConstraintByUid(m_data->m_pickConstraint); m_data->m_rigidBodyPipeline->removeConstraintByUid(m_data->m_pickConstraint);
b3Vector3 newRayTo = getRayTo(x,y); b3Vector3 newRayTo = getRayTo(x,y);
b3Vector3 rayFrom; b3Vector3 rayFrom;
b3Vector3 oldPivotInB = m_data->m_pickPivotInB; // b3Vector3 oldPivotInB = m_data->m_pickPivotInB;
b3Vector3 newPivotB; b3Vector3 newPivotB;
m_guiHelper->getRenderInterface()->getActiveCamera()->getCameraPosition(rayFrom); m_guiHelper->getRenderInterface()->getActiveCamera()->getCameraPosition(rayFrom);
b3Vector3 dir = newRayTo-rayFrom; b3Vector3 dir = newRayTo-rayFrom;

View File

@@ -163,10 +163,10 @@ struct InternalDataRenderer : public GLInstanceRendererInternalData
InternalDataRenderer() : InternalDataRenderer() :
m_activeCamera(&m_defaultCamera1),
m_shadowMap(0), m_shadowMap(0),
m_shadowTexture(0), m_shadowTexture(0),
m_renderFrameBuffer(0), m_renderFrameBuffer(0)
m_activeCamera(&m_defaultCamera1)
{ {
//clear to zero to make it obvious if the matrix is used uninitialized //clear to zero to make it obvious if the matrix is used uninitialized
for (int i=0;i<16;i++) for (int i=0;i<16;i++)
@@ -616,7 +616,7 @@ int GLInstancingRenderer::registerTexture(const unsigned char* texels, int width
b3Assert(glGetError() ==GL_NO_ERROR); b3Assert(glGetError() ==GL_NO_ERROR);
glActiveTexture(GL_TEXTURE0); glActiveTexture(GL_TEXTURE0);
int textureIndex = m_data->m_textureHandles.size(); int textureIndex = m_data->m_textureHandles.size();
const GLubyte* image= (const GLubyte*)texels; // const GLubyte* image= (const GLubyte*)texels;
GLuint textureHandle; GLuint textureHandle;
glGenTextures(1,(GLuint*)&textureHandle); glGenTextures(1,(GLuint*)&textureHandle);
glBindTexture(GL_TEXTURE_2D,textureHandle); glBindTexture(GL_TEXTURE_2D,textureHandle);
@@ -661,7 +661,7 @@ void GLInstancingRenderer::updateTexture(int textureIndex, const unsigned cha
glBindTexture(GL_TEXTURE_2D,h.m_glTexture); glBindTexture(GL_TEXTURE_2D,h.m_glTexture);
b3Assert(glGetError() ==GL_NO_ERROR); b3Assert(glGetError() ==GL_NO_ERROR);
const GLubyte* image= (const GLubyte*)texels; // const GLubyte* image= (const GLubyte*)texels;
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, h.m_width,h.m_height,0,GL_RGB,GL_UNSIGNED_BYTE,&flippedTexels[0]); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, h.m_width,h.m_height,0,GL_RGB,GL_UNSIGNED_BYTE,&flippedTexels[0]);
b3Assert(glGetError() ==GL_NO_ERROR); b3Assert(glGetError() ==GL_NO_ERROR);
glGenerateMipmap(GL_TEXTURE_2D); glGenerateMipmap(GL_TEXTURE_2D);

View File

@@ -456,7 +456,7 @@ void GLPrimitiveRenderer::drawTexturedRect2a(float x0, float y0, float x1, float
PrimVertex( PrimVec4( -1.f+2.f*x1/float(m_screenWidth), 1.f-2.f*y0/float(m_screenHeight), 0.f, 1.f ), PrimVec4( color[0], color[1], color[2], color[3] ) ,PrimVec2(u1,v0)) PrimVertex( PrimVec4( -1.f+2.f*x1/float(m_screenWidth), 1.f-2.f*y0/float(m_screenHeight), 0.f, 1.f ), PrimVec4( color[0], color[1], color[2], color[3] ) ,PrimVec2(u1,v0))
}; };
int sz = m_data2->m_numVerticesText; // int sz = m_data2->m_numVerticesText;
m_data2->m_verticesRect[m_data2->m_numVerticesRect++]=vertexData[0]; m_data2->m_verticesRect[m_data2->m_numVerticesRect++]=vertexData[0];
m_data2->m_verticesRect[m_data2->m_numVerticesRect++]=vertexData[1]; m_data2->m_verticesRect[m_data2->m_numVerticesRect++]=vertexData[1];
@@ -492,7 +492,7 @@ void GLPrimitiveRenderer::drawTexturedRect2(float x0, float y0, float x1, float
PrimVertex( PrimVec4( -1.f+2.f*x1/float(m_screenWidth), 1.f-2.f*y0/float(m_screenHeight), 0.f, 1.f ), PrimVec4( color[0], color[1], color[2], color[3] ) ,PrimVec2(u1,v0)) PrimVertex( PrimVec4( -1.f+2.f*x1/float(m_screenWidth), 1.f-2.f*y0/float(m_screenHeight), 0.f, 1.f ), PrimVec4( color[0], color[1], color[2], color[3] ) ,PrimVec2(u1,v0))
}; };
int sz = m_data2->m_numVerticesText; // int sz = m_data2->m_numVerticesText;
m_data2->m_verticesText[m_data2->m_numVerticesText++]=vertexData[0]; m_data2->m_verticesText[m_data2->m_numVerticesText++]=vertexData[0];
m_data2->m_verticesText[m_data2->m_numVerticesText++]=vertexData[1]; m_data2->m_verticesText[m_data2->m_numVerticesText++]=vertexData[1];

View File

@@ -223,8 +223,8 @@ MacOpenGLWindow::MacOpenGLWindow()
m_mouseX(0), m_mouseX(0),
m_mouseY(0), m_mouseY(0),
m_modifierFlags(0), m_modifierFlags(0),
m_mouseMoveCallback(0),
m_mouseButtonCallback(0), m_mouseButtonCallback(0),
m_mouseMoveCallback(0),
m_wheelCallback(0), m_wheelCallback(0),
m_keyboardCallback(0), m_keyboardCallback(0),
m_retinaScaleFactor(1), m_retinaScaleFactor(1),
@@ -334,10 +334,10 @@ void MacOpenGLWindow::createWindow(const b3gWindowConstructionInfo& ci)
// add Edit menu // add Edit menu
NSMenuItem *editMenuItem = [[NSMenuItem new] autorelease]; NSMenuItem *editMenuItem = [[NSMenuItem new] autorelease];
NSMenu *menu = [[NSMenu allocWithZone:[NSMenu menuZone]]initWithTitle:@"Edit"]; NSMenu *menu = [[NSMenu alloc]initWithTitle:@"Edit"];
[editMenuItem setSubmenu: menu]; [editMenuItem setSubmenu: menu];
NSMenuItem *copyItem = [[NSMenuItem allocWithZone:[NSMenu menuZone]]initWithTitle:@"Copy" action:@selector(copy:) keyEquivalent:@"c"]; NSMenuItem *copyItem = [[NSMenuItem alloc]initWithTitle:@"Copy" action:@selector(copy:) keyEquivalent:@"c"];
[menu addItem:copyItem]; [menu addItem:copyItem];
[menubar addItem:editMenuItem]; [menubar addItem:editMenuItem];

View File

@@ -20,10 +20,7 @@
class DynamicTexturedCubeDemo : public CommonExampleInterface class DynamicTexturedCubeDemo : public CommonExampleInterface
{ {
CommonGraphicsApp* m_app; CommonGraphicsApp* m_app;
float m_x; b3AlignedObjectArray<int> m_movingInstances;
float m_y;
float m_z;
b3AlignedObjectArray<int> m_movingInstances;
TinyVRGui* m_tinyVrGUI; TinyVRGui* m_tinyVrGUI;
@@ -37,10 +34,7 @@ public:
DynamicTexturedCubeDemo(CommonGraphicsApp* app) DynamicTexturedCubeDemo(CommonGraphicsApp* app)
:m_app(app), :m_app(app),
m_x(0), m_tinyVrGUI(0)
m_y(0),
m_z(0),
m_tinyVrGUI(0)
{ {
m_app->setUpAxis(2); m_app->setUpAxis(2);

View File

@@ -76,16 +76,16 @@ struct RaytracerInternalData
RaytracerInternalData() RaytracerInternalData()
:m_canvasIndex(-1), :m_canvasIndex(-1),
m_canvas(0), m_canvas(0),
m_roll(0),
m_pitch(0),
m_yaw(0),
#ifdef _DEBUG #ifdef _DEBUG
m_width(64), m_width(64),
m_height(64) m_height(64),
#else #else
m_width(128), m_width(128),
m_height(128) m_height(128),
#endif #endif
m_pitch(0),
m_roll(0),
m_yaw(0)
{ {
btConeShape* cone = new btConeShape(1,1); btConeShape* cone = new btConeShape(1,1);
btSphereShape* sphere = new btSphereShape(1); btSphereShape* sphere = new btSphereShape(1);
@@ -300,7 +300,7 @@ void RaytracerPhysicsSetup::stepSimulation(float deltaTime)
int mode = 0; // int mode = 0;
int x,y; int x,y;
for (x=0;x<m_internalData->m_width;x++) for (x=0;x<m_internalData->m_width;x++)

View File

@@ -298,7 +298,7 @@ void TimeSeriesCanvas::insertDataAtCurrentTime(float orgV, int dataSourceIndex,
float amp = m_internalData->m_pixelsPerUnit; float amp = m_internalData->m_pixelsPerUnit;
//insert some new value(s) in the right-most column //insert some new value(s) in the right-most column
{ {
float time = m_internalData->getTime(); // float time = m_internalData->getTime();
float v = zero+amp*orgV; float v = zero+amp*orgV;

View File

@@ -43,14 +43,14 @@ struct TinyRendererSetupInternalData
int m_animateRenderer; int m_animateRenderer;
TinyRendererSetupInternalData(int width, int height) TinyRendererSetupInternalData(int width, int height)
:m_roll(0), :
m_pitch(0),
m_yaw(0),
m_width(width),
m_height(height),
m_rgbColorBuffer(width,height,TGAImage::RGB), m_rgbColorBuffer(width,height,TGAImage::RGB),
m_textureHandle(0), m_width(width),
m_height(height),
m_pitch(0),
m_roll(0),
m_yaw(0),
m_textureHandle(0),
m_animateRenderer(0) m_animateRenderer(0)
{ {
m_depthBuffer.resize(m_width*m_height); m_depthBuffer.resize(m_width*m_height);

View File

@@ -19,9 +19,10 @@ struct TestCanvasInterface2 : public Common2dCanvasInterface
int m_height; int m_height;
TestCanvasInterface2(b3AlignedObjectArray<unsigned char>& texelsRGB, int width, int height) TestCanvasInterface2(b3AlignedObjectArray<unsigned char>& texelsRGB, int width, int height)
:m_width(width), :
m_height(height), m_texelsRGB(texelsRGB),
m_texelsRGB(texelsRGB) m_width(width),
m_height(height)
{ {
} }

View File

@@ -157,7 +157,8 @@ void RigidBodySoftContact::initPhysics()
btScalar(2.0*j))); btScalar(2.0*j)));
btRigidBody* body = createRigidBody(mass,startTransform,colShape); btRigidBody* body;
body = createRigidBody(mass,startTransform,colShape);
//body->setAngularVelocity(btVector3(1,1,1)); //body->setAngularVelocity(btVector3(1,1,1));

View File

@@ -25,13 +25,9 @@ class GripperGraspExample : public CommonExampleInterface
GUIHelperInterface* m_guiHelper; GUIHelperInterface* m_guiHelper;
b3RobotSimAPI m_robotSim; b3RobotSimAPI m_robotSim;
int m_options; int m_options;
int m_r2d2Index;
int m_gripperIndex; int m_gripperIndex;
float m_x; b3AlignedObjectArray<int> m_movingInstances;
float m_y;
float m_z;
b3AlignedObjectArray<int> m_movingInstances;
enum enum
{ {
numCubesX = 20, numCubesX = 20,
@@ -43,12 +39,8 @@ public:
:m_app(helper->getAppInterface()), :m_app(helper->getAppInterface()),
m_guiHelper(helper), m_guiHelper(helper),
m_options(options), m_options(options),
m_r2d2Index(-1), m_gripperIndex(-1)
m_gripperIndex(-1), {
m_x(0),
m_y(0),
m_z(0)
{
m_app->setUpAxis(2); m_app->setUpAxis(2);
} }
virtual ~GripperGraspExample() virtual ~GripperGraspExample()

View File

@@ -30,7 +30,7 @@ class KukaGraspExample : public CommonExampleInterface
b3Vector4 m_targetOri; b3Vector4 m_targetOri;
b3Vector4 m_worldOri; b3Vector4 m_worldOri;
double m_time; double m_time;
int m_options; // int m_options;
b3AlignedObjectArray<int> m_movingInstances; b3AlignedObjectArray<int> m_movingInstances;
enum enum
@@ -40,10 +40,10 @@ class KukaGraspExample : public CommonExampleInterface
}; };
public: public:
KukaGraspExample(GUIHelperInterface* helper, int options) KukaGraspExample(GUIHelperInterface* helper, int /* options */)
:m_app(helper->getAppInterface()), :m_app(helper->getAppInterface()),
m_guiHelper(helper), m_guiHelper(helper),
m_options(options), // m_options(options),
m_kukaIndex(-1), m_kukaIndex(-1),
m_time(0) m_time(0)
{ {

View File

@@ -23,9 +23,6 @@ class R2D2GraspExample : public CommonExampleInterface
int m_options; int m_options;
int m_r2d2Index; int m_r2d2Index;
float m_x;
float m_y;
float m_z;
b3AlignedObjectArray<int> m_movingInstances; b3AlignedObjectArray<int> m_movingInstances;
enum enum
{ {
@@ -38,10 +35,7 @@ public:
:m_app(helper->getAppInterface()), :m_app(helper->getAppInterface()),
m_guiHelper(helper), m_guiHelper(helper),
m_options(options), m_options(options),
m_r2d2Index(-1), m_r2d2Index(-1)
m_x(0),
m_y(0),
m_z(0)
{ {
m_app->setUpAxis(2); m_app->setUpAxis(2);
} }
@@ -70,7 +64,7 @@ public:
b3RobotSimLoadFileResults results; b3RobotSimLoadFileResults results;
if (m_robotSim.loadFile(args, results) && results.m_uniqueObjectIds.size()==1) if (m_robotSim.loadFile(args, results) && results.m_uniqueObjectIds.size()==1)
{ {
int m_r2d2Index = results.m_uniqueObjectIds[0]; m_r2d2Index = results.m_uniqueObjectIds[0];
int numJoints = m_robotSim.getNumJoints(m_r2d2Index); int numJoints = m_robotSim.getNumJoints(m_r2d2Index);
b3Printf("numJoints = %d",numJoints); b3Printf("numJoints = %d",numJoints);

View File

@@ -106,10 +106,10 @@ struct RobotSimThreadLocalStorage
void RobotThreadFunc(void* userPtr,void* lsMemory) void RobotThreadFunc(void* userPtr,void* lsMemory)
{ {
printf("RobotThreadFunc thread started\n"); printf("RobotThreadFunc thread started\n");
RobotSimThreadLocalStorage* localStorage = (RobotSimThreadLocalStorage*) lsMemory; // RobotSimThreadLocalStorage* localStorage = (RobotSimThreadLocalStorage*) lsMemory;
RobotSimArgs* args = (RobotSimArgs*) userPtr; RobotSimArgs* args = (RobotSimArgs*) userPtr;
int workLeft = true; // int workLeft = true;
b3Clock clock; b3Clock clock;
clock.reset(); clock.reset();
bool init = true; bool init = true;
@@ -157,7 +157,7 @@ void* RobotlsMemoryFunc()
ATTRIBUTE_ALIGNED16(class) MultiThreadedOpenGLGuiHelper2 : public GUIHelperInterface ATTRIBUTE_ALIGNED16(class) MultiThreadedOpenGLGuiHelper2 : public GUIHelperInterface
{ {
CommonGraphicsApp* m_app; // CommonGraphicsApp* m_app;
b3CriticalSection* m_cs; b3CriticalSection* m_cs;
@@ -188,9 +188,8 @@ public:
int m_instanceId; int m_instanceId;
MultiThreadedOpenGLGuiHelper2(CommonGraphicsApp* app, GUIHelperInterface* guiHelper) MultiThreadedOpenGLGuiHelper2( GUIHelperInterface* guiHelper)
:m_app(app) : m_cs(0),
,m_cs(0),
m_texels(0), m_texels(0),
m_textureId(-1) m_textureId(-1)
{ {
@@ -439,11 +438,13 @@ struct b3RobotSimAPI_InternalData
bool m_connected; bool m_connected;
b3RobotSimAPI_InternalData() b3RobotSimAPI_InternalData()
:m_threadSupport(0), :
m_multiThreadedHelper(0), m_physicsClient(0),
m_clientServerDirect(0), m_threadSupport(0),
m_physicsClient(0), m_multiThreadedHelper(0),
m_useMultiThreading(false),
m_clientServerDirect(0),
m_useMultiThreading(false),
m_connected(false) m_connected(false)
{ {
} }
@@ -695,7 +696,7 @@ bool b3RobotSimAPI::getJointStates(int bodyUniqueId, b3JointStates& state)
if (statusHandle) if (statusHandle)
{ {
double rootInertialFrame[7]; // double rootInertialFrame[7];
const double* rootLocalInertialFrame; const double* rootLocalInertialFrame;
const double* actualStateQ; const double* actualStateQ;
const double* actualStateQdot; const double* actualStateQdot;
@@ -843,7 +844,8 @@ bool b3RobotSimAPI::loadFile(const struct b3RobotSimLoadFileArgs& args, b3RobotS
if (numBodies) if (numBodies)
{ {
results.m_uniqueObjectIds.resize(numBodies); results.m_uniqueObjectIds.resize(numBodies);
int numBodies = b3GetStatusBodyIndices(statusHandle, &results.m_uniqueObjectIds[0],results.m_uniqueObjectIds.size()); int numBodies;
numBodies = b3GetStatusBodyIndices(statusHandle, &results.m_uniqueObjectIds[0],results.m_uniqueObjectIds.size());
} }
statusOk = true; statusOk = true;
@@ -865,11 +867,7 @@ bool b3RobotSimAPI::connect(GUIHelperInterface* guiHelper)
{ {
if (m_data->m_useMultiThreading) if (m_data->m_useMultiThreading)
{ {
m_data->m_multiThreadedHelper = new MultiThreadedOpenGLGuiHelper2(guiHelper->getAppInterface(), guiHelper); m_data->m_multiThreadedHelper = new MultiThreadedOpenGLGuiHelper2(guiHelper);
MultiThreadedOpenGLGuiHelper2* guiHelperWrapper = new MultiThreadedOpenGLGuiHelper2(guiHelper->getAppInterface(), guiHelper);
m_data->m_threadSupport = createRobotSimThreadSupport(MAX_ROBOT_NUM_THREADS); m_data->m_threadSupport = createRobotSimThreadSupport(MAX_ROBOT_NUM_THREADS);
@@ -892,7 +890,7 @@ bool b3RobotSimAPI::connect(GUIHelperInterface* guiHelper)
int numMoving = 0; int numMoving = 0;
m_data->m_args[w].m_positions.resize(numMoving); m_data->m_args[w].m_positions.resize(numMoving);
m_data->m_args[w].m_physicsServerPtr = &m_data->m_physicsServer; m_data->m_args[w].m_physicsServerPtr = &m_data->m_physicsServer;
int index = 0; //int index = 0;
m_data->m_threadSupport->runTask(B3_THREAD_SCHEDULE_TASK, (void*)&m_data->m_args[w], w); m_data->m_threadSupport->runTask(B3_THREAD_SCHEDULE_TASK, (void*)&m_data->m_args[w], w);
while (m_data->m_args[w].m_cs->getSharedParam(0) == eRobotSimIsUnInitialized) while (m_data->m_args[w].m_cs->getSharedParam(0) == eRobotSimIsUnInitialized)
@@ -912,7 +910,8 @@ bool b3RobotSimAPI::connect(GUIHelperInterface* guiHelper)
{ {
PhysicsServerCommandProcessor* sdk = new PhysicsServerCommandProcessor; PhysicsServerCommandProcessor* sdk = new PhysicsServerCommandProcessor;
m_data->m_clientServerDirect = new PhysicsDirect(sdk,true); m_data->m_clientServerDirect = new PhysicsDirect(sdk,true);
bool connected = m_data->m_clientServerDirect->connect(guiHelper); bool connected;
connected = m_data->m_clientServerDirect->connect(guiHelper);
m_data->m_physicsClient = (b3PhysicsClientHandle)m_data->m_clientServerDirect; m_data->m_physicsClient = (b3PhysicsClientHandle)m_data->m_clientServerDirect;
} }

View File

@@ -514,13 +514,13 @@ m_wantsTermination(false),
m_sharedMemoryKey(SHARED_MEMORY_KEY), m_sharedMemoryKey(SHARED_MEMORY_KEY),
m_selectedBody(-1), m_selectedBody(-1),
m_prevSelectedBody(-1), m_prevSelectedBody(-1),
m_numMotors(0),
m_options(options),
m_isOptionalServerConnected(false),
m_canvas(0), m_canvas(0),
m_canvasRGBIndex(-1), m_canvasRGBIndex(-1),
m_canvasDepthIndex(-1), m_canvasDepthIndex(-1),
m_canvasSegMaskIndex(-1) m_canvasSegMaskIndex(-1),
m_numMotors(0),
m_options(options),
m_isOptionalServerConnected(false)
{ {
b3Printf("Started PhysicsClientExample\n"); b3Printf("Started PhysicsClientExample\n");

View File

@@ -62,10 +62,9 @@ struct PhysicsClientSharedMemoryInternalData {
: m_sharedMemory(0), : m_sharedMemory(0),
m_ownsSharedMemory(false), m_ownsSharedMemory(false),
m_testBlock1(0), m_testBlock1(0),
m_counter(0),
m_cachedCameraPixelsWidth(0), m_cachedCameraPixelsWidth(0),
m_cachedCameraPixelsHeight(0), m_cachedCameraPixelsHeight(0),
m_counter(0),
m_isConnected(false), m_isConnected(false),
m_waitingForServer(false), m_waitingForServer(false),
m_hasLastServerStatus(false), m_hasLastServerStatus(false),
@@ -283,7 +282,7 @@ void PhysicsClientSharedMemory::processBodyJointInfo(int bodyUniqueId, const Sha
} }
const SharedMemoryStatus* PhysicsClientSharedMemory::processServerStatus() { const SharedMemoryStatus* PhysicsClientSharedMemory::processServerStatus() {
SharedMemoryStatus* stat = 0; // SharedMemoryStatus* stat = 0;
if (!m_data->m_testBlock1) { if (!m_data->m_testBlock1) {
m_data->m_lastServerStatus.m_type = CMD_SHARED_MEMORY_NOT_INITIALIZED; m_data->m_lastServerStatus.m_type = CMD_SHARED_MEMORY_NOT_INITIALIZED;
@@ -308,7 +307,7 @@ const SharedMemoryStatus* PhysicsClientSharedMemory::processServerStatus() {
const SharedMemoryStatus& serverCmd = m_data->m_testBlock1->m_serverCommands[0]; const SharedMemoryStatus& serverCmd = m_data->m_testBlock1->m_serverCommands[0];
m_data->m_lastServerStatus = serverCmd; m_data->m_lastServerStatus = serverCmd;
EnumSharedMemoryServerStatus s = (EnumSharedMemoryServerStatus)serverCmd.m_type; // EnumSharedMemoryServerStatus s = (EnumSharedMemoryServerStatus)serverCmd.m_type;
// consume the command // consume the command
switch (serverCmd.m_type) { switch (serverCmd.m_type) {

View File

@@ -170,7 +170,7 @@ struct UdpNetworkedInternalData
if (gVerboseNetworkMessagesClient) if (gVerboseNetworkMessagesClient)
{ {
printf("A packet of length %u containing '%s' was " printf("A packet of length %lu containing '%s' was "
"received from %s on channel %u.\n", "received from %s on channel %u.\n",
m_event.packet->dataLength, m_event.packet->dataLength,
m_event.packet->data, m_event.packet->data,
@@ -225,7 +225,7 @@ struct UdpNetworkedInternalData
{ {
if (gVerboseNetworkMessagesClient) if (gVerboseNetworkMessagesClient)
{ {
printf("A packet of length %u containing '%s' was " printf("A packet of length %lu containing '%s' was "
"received from %s on channel %u.\n", "received from %s on channel %u.\n",
m_event.packet->dataLength, m_event.packet->dataLength,
m_event.packet->data, m_event.packet->data,
@@ -303,10 +303,10 @@ enum UDPCommandEnums
void UDPThreadFunc(void* userPtr, void* lsMemory) void UDPThreadFunc(void* userPtr, void* lsMemory)
{ {
printf("UDPThreadFunc thread started\n"); printf("UDPThreadFunc thread started\n");
UDPThreadLocalStorage* localStorage = (UDPThreadLocalStorage*)lsMemory; // UDPThreadLocalStorage* localStorage = (UDPThreadLocalStorage*)lsMemory;
UdpNetworkedInternalData* args = (UdpNetworkedInternalData*)userPtr; UdpNetworkedInternalData* args = (UdpNetworkedInternalData*)userPtr;
int workLeft = true; // int workLeft = true;
b3Clock clock; b3Clock clock;
clock.reset(); clock.reset();
bool init = true; bool init = true;
@@ -366,7 +366,8 @@ void UDPThreadFunc(void* userPtr, void* lsMemory)
int sz = sizeof(SharedMemoryCommand); int sz = sizeof(SharedMemoryCommand);
ENetPacket *packet = enet_packet_create(&args->m_clientCmd, sz, ENET_PACKET_FLAG_RELIABLE); ENetPacket *packet = enet_packet_create(&args->m_clientCmd, sz, ENET_PACKET_FLAG_RELIABLE);
int res = enet_peer_send(args->m_peer, 0, packet); int res;
res = enet_peer_send(args->m_peer, 0, packet);
args->m_cs->lock(); args->m_cs->lock();
args->m_hasCommand = false; args->m_hasCommand = false;
args->m_cs->unlock(); args->m_cs->unlock();
@@ -440,7 +441,7 @@ UdpNetworkedPhysicsProcessor::~UdpNetworkedPhysicsProcessor()
bool UdpNetworkedPhysicsProcessor::processCommand(const struct SharedMemoryCommand& clientCmd, struct SharedMemoryStatus& serverStatusOut, char* bufferServerToClient, int bufferSizeInBytes) bool UdpNetworkedPhysicsProcessor::processCommand(const struct SharedMemoryCommand& clientCmd, struct SharedMemoryStatus& serverStatusOut, char* bufferServerToClient, int bufferSizeInBytes)
{ {
int sz = sizeof(SharedMemoryCommand); // int sz = sizeof(SharedMemoryCommand);
int timeout = 1024 * 1024 * 1024; int timeout = 1024 * 1024 * 1024;
m_data->m_cs->lock(); m_data->m_cs->lock();

View File

@@ -12,7 +12,8 @@ b3PhysicsClientHandle b3ConnectPhysicsUDP(const char* hostName, int port)
PhysicsDirect* direct = new PhysicsDirect(udp,true); PhysicsDirect* direct = new PhysicsDirect(udp,true);
bool connected = direct->connect(); bool connected;
connected = direct->connect();
printf("direct!\n"); printf("direct!\n");
return (b3PhysicsClientHandle)direct; return (b3PhysicsClientHandle)direct;
} }

View File

@@ -12,7 +12,8 @@ b3PhysicsClientHandle b3ConnectPhysicsDirect()
PhysicsServerCommandProcessor* sdk = new PhysicsServerCommandProcessor; PhysicsServerCommandProcessor* sdk = new PhysicsServerCommandProcessor;
PhysicsDirect* direct = new PhysicsDirect(sdk,true); PhysicsDirect* direct = new PhysicsDirect(sdk,true);
bool connected = direct->connect(); bool connected;
connected = direct->connect();
return (b3PhysicsClientHandle )direct; return (b3PhysicsClientHandle )direct;
} }

View File

@@ -9,7 +9,8 @@ b3PhysicsClientHandle b3ConnectPhysicsLoopback(int key)
{ {
PhysicsLoopBack* loopBack = new PhysicsLoopBack(); PhysicsLoopBack* loopBack = new PhysicsLoopBack();
loopBack->setSharedMemoryKey(key); loopBack->setSharedMemoryKey(key);
bool connected = loopBack->connect(); bool connected;
connected = loopBack->connect();
return (b3PhysicsClientHandle )loopBack; return (b3PhysicsClientHandle )loopBack;
} }

View File

@@ -438,7 +438,7 @@ struct PhysicsServerCommandProcessorInternalData
if (m_firstFreeHandle<0) if (m_firstFreeHandle<0)
{ {
int curCapacity = m_bodyHandles.size(); //int curCapacity = m_bodyHandles.size();
int additionalCapacity= m_bodyHandles.size(); int additionalCapacity= m_bodyHandles.size();
increaseHandleCapacity(additionalCapacity); increaseHandleCapacity(additionalCapacity);
@@ -541,14 +541,15 @@ struct PhysicsServerCommandProcessorInternalData
TinyRendererVisualShapeConverter m_visualConverter; TinyRendererVisualShapeConverter m_visualConverter;
PhysicsServerCommandProcessorInternalData() PhysicsServerCommandProcessorInternalData()
:m_hasGround(false), :
m_gripperRigidbodyFixed(0), m_allowRealTimeSimulation(false),
m_hasGround(false),
m_gripperRigidbodyFixed(0),
m_gripperMultiBody(0), m_gripperMultiBody(0),
m_kukaGripperFixed(0), m_kukaGripperFixed(0),
m_kukaGripperMultiBody(0), m_kukaGripperMultiBody(0),
m_kukaGripperRevolute1(0), m_kukaGripperRevolute1(0),
m_kukaGripperRevolute2(0), m_kukaGripperRevolute2(0),
m_allowRealTimeSimulation(false),
m_huskyId(-1), m_huskyId(-1),
m_KukaId(-1), m_KukaId(-1),
m_sphereId(-1), m_sphereId(-1),
@@ -1336,7 +1337,7 @@ bool PhysicsServerCommandProcessor::processCommand(const struct SharedMemoryComm
//m_data->m_testBlock1->m_numProcessedClientCommands++; //m_data->m_testBlock1->m_numProcessedClientCommands++;
//no timestamp yet //no timestamp yet
int timeStamp = 0; //int timeStamp = 0;
//catch uninitialized cases //catch uninitialized cases
serverStatusOut.m_type = CMD_INVALID_STATUS; serverStatusOut.m_type = CMD_INVALID_STATUS;
@@ -2920,9 +2921,9 @@ bool PhysicsServerCommandProcessor::processCommand(const struct SharedMemoryComm
serverCmd.m_type = CMD_REQUEST_AABB_OVERLAP_COMPLETED; serverCmd.m_type = CMD_REQUEST_AABB_OVERLAP_COMPLETED;
int m_startingOverlappingObjectIndex; //int m_startingOverlappingObjectIndex;
int m_numOverlappingObjectsCopied; //int m_numOverlappingObjectsCopied;
int m_numRemainingOverlappingObjects; //int m_numRemainingOverlappingObjects;
serverCmd.m_sendOverlappingObjectsArgs.m_startingOverlappingObjectIndex = clientCmd.m_requestOverlappingObjectsArgs.m_startingOverlappingObjectIndex; serverCmd.m_sendOverlappingObjectsArgs.m_startingOverlappingObjectIndex = clientCmd.m_requestOverlappingObjectsArgs.m_startingOverlappingObjectIndex;
serverCmd.m_sendOverlappingObjectsArgs.m_numOverlappingObjectsCopied = m_data->m_cachedOverlappingObjects.m_bodyUniqueIds.size(); serverCmd.m_sendOverlappingObjectsArgs.m_numOverlappingObjectsCopied = m_data->m_cachedOverlappingObjects.m_bodyUniqueIds.size();
serverCmd.m_sendOverlappingObjectsArgs.m_numRemainingOverlappingObjects = remainingObjects - curNumObjects; serverCmd.m_sendOverlappingObjectsArgs.m_numRemainingOverlappingObjects = remainingObjects - curNumObjects;
@@ -3133,8 +3134,6 @@ bool PhysicsServerCommandProcessor::processCommand(const struct SharedMemoryComm
///ContactResultCallback is used to report contact points ///ContactResultCallback is used to report contact points
struct MyContactResultCallback : public btCollisionWorld::ContactResultCallback struct MyContactResultCallback : public btCollisionWorld::ContactResultCallback
{ {
//short int m_collisionFilterGroup;
//short int m_collisionFilterMask;
int m_bodyUniqueIdA; int m_bodyUniqueIdA;
int m_bodyUniqueIdB; int m_bodyUniqueIdB;
int m_linkIndexA; int m_linkIndexA;
@@ -3789,8 +3788,8 @@ bool PhysicsServerCommandProcessor::processCommand(const struct SharedMemoryComm
//retrieve the visual shape information for a specific body //retrieve the visual shape information for a specific body
int totalNumVisualShapes = m_data->m_visualConverter.getNumVisualShapes(clientCmd.m_requestVisualShapeDataArguments.m_bodyUniqueId); int totalNumVisualShapes = m_data->m_visualConverter.getNumVisualShapes(clientCmd.m_requestVisualShapeDataArguments.m_bodyUniqueId);
int totalBytesPerVisualShape = sizeof (b3VisualShapeData); //int totalBytesPerVisualShape = sizeof (b3VisualShapeData);
int visualShapeStorage = bufferSizeInBytes / totalBytesPerVisualShape - 1; //int visualShapeStorage = bufferSizeInBytes / totalBytesPerVisualShape - 1;
b3VisualShapeData* visualShapeStoragePtr = (b3VisualShapeData*)bufferServerToClient; b3VisualShapeData* visualShapeStoragePtr = (b3VisualShapeData*)bufferServerToClient;
int remain = totalNumVisualShapes - clientCmd.m_requestVisualShapeDataArguments.m_startingVisualShapeIndex; int remain = totalNumVisualShapes - clientCmd.m_requestVisualShapeDataArguments.m_startingVisualShapeIndex;
@@ -4084,7 +4083,7 @@ bool PhysicsServerCommandProcessor::processCommand(const struct SharedMemoryComm
return hasStatus; return hasStatus;
} }
static int skip=1; //static int skip=1;
void PhysicsServerCommandProcessor::renderScene() void PhysicsServerCommandProcessor::renderScene()
{ {

View File

@@ -56,6 +56,29 @@ const char* startFileNameVR = "0_VRDemoSettings.txt";
#include <vector> #include <vector>
static void loadCurrentSettingsVR(b3CommandLineArgs& args)
{
//int currentEntry = 0;
FILE* f = fopen(startFileNameVR, "r");
if (f)
{
char oneline[1024];
char* argv[] = { 0,&oneline[0] };
while (fgets(oneline, 1024, f) != NULL)
{
char *pos;
if ((pos = strchr(oneline, '\n')) != NULL)
*pos = '\0';
args.addArgs(2, argv);
}
fclose(f);
}
};
#if B3_USE_MIDI
//remember the settings (you don't want to re-tune again and again...) //remember the settings (you don't want to re-tune again and again...)
static void saveCurrentSettingsVR() static void saveCurrentSettingsVR()
{ {
@@ -70,27 +93,6 @@ static void saveCurrentSettingsVR()
} }
}; };
static void loadCurrentSettingsVR(b3CommandLineArgs& args)
{
int currentEntry = 0;
FILE* f = fopen(startFileNameVR, "r");
if (f)
{
char oneline[1024];
char* argv[] = { 0,&oneline[0] };
while (fgets(oneline, 1024, f) != NULL)
{
char *pos;
if ((pos = strchr(oneline, '\n')) != NULL)
*pos = '\0';
args.addArgs(2, argv);
}
fclose(f);
}
};
#if B3_USE_MIDI
static float getParamf(float rangeMin, float rangeMax, int midiVal) static float getParamf(float rangeMin, float rangeMax, int midiVal)
@@ -280,10 +282,10 @@ float sleepTimeThreshold = 8./1000.;
void MotionThreadFunc(void* userPtr,void* lsMemory) void MotionThreadFunc(void* userPtr,void* lsMemory)
{ {
printf("MotionThreadFunc thread started\n"); printf("MotionThreadFunc thread started\n");
MotionThreadLocalStorage* localStorage = (MotionThreadLocalStorage*) lsMemory; //MotionThreadLocalStorage* localStorage = (MotionThreadLocalStorage*) lsMemory;
MotionArgs* args = (MotionArgs*) userPtr; MotionArgs* args = (MotionArgs*) userPtr;
int workLeft = true; //int workLeft = true;
b3Clock clock; b3Clock clock;
clock.reset(); clock.reset();
bool init = true; bool init = true;
@@ -494,7 +496,7 @@ struct UserDebugText
class MultiThreadedOpenGLGuiHelper : public GUIHelperInterface class MultiThreadedOpenGLGuiHelper : public GUIHelperInterface
{ {
CommonGraphicsApp* m_app; // CommonGraphicsApp* m_app;
b3CriticalSection* m_cs; b3CriticalSection* m_cs;
b3CriticalSection* m_cs2; b3CriticalSection* m_cs2;
@@ -558,8 +560,9 @@ public:
} }
MultiThreadedOpenGLGuiHelper(CommonGraphicsApp* app, GUIHelperInterface* guiHelper) MultiThreadedOpenGLGuiHelper(CommonGraphicsApp* app, GUIHelperInterface* guiHelper)
:m_app(app) :
,m_cs(0), //m_app(app),
m_cs(0),
m_cs2(0), m_cs2(0),
m_cs3(0), m_cs3(0),
m_csGUI(0), m_csGUI(0),
@@ -816,7 +819,7 @@ public:
m_tmpText.m_itemUniqueId = m_uidGenerator++; m_tmpText.m_itemUniqueId = m_uidGenerator++;
m_tmpText.m_lifeTime = lifeTime; m_tmpText.m_lifeTime = lifeTime;
m_tmpText.textSize = size; m_tmpText.textSize = size;
int len = strlen(txt); //int len = strlen(txt);
strcpy(m_tmpText.m_text,txt); strcpy(m_tmpText.m_text,txt);
m_tmpText.m_textPositionXYZ[0] = positionXYZ[0]; m_tmpText.m_textPositionXYZ[0] = positionXYZ[0];
m_tmpText.m_textPositionXYZ[1] = positionXYZ[1]; m_tmpText.m_textPositionXYZ[1] = positionXYZ[1];
@@ -893,7 +896,7 @@ class PhysicsServerExample : public SharedMemoryCommon
bool m_isConnected; bool m_isConnected;
btClock m_clock; btClock m_clock;
bool m_replay; bool m_replay;
int m_options; // int m_options;
#ifdef BT_ENABLE_VR #ifdef BT_ENABLE_VR
TinyVRGui* m_tinyVrGui; TinyVRGui* m_tinyVrGui;
@@ -1123,8 +1126,8 @@ PhysicsServerExample::PhysicsServerExample(MultiThreadedOpenGLGuiHelper* helper,
m_physicsServer(sharedMem), m_physicsServer(sharedMem),
m_wantsShutdown(false), m_wantsShutdown(false),
m_isConnected(false), m_isConnected(false),
m_replay(false), m_replay(false)
m_options(options) //m_options(options)
#ifdef BT_ENABLE_VR #ifdef BT_ENABLE_VR
,m_tinyVrGui(0) ,m_tinyVrGui(0)
#endif #endif
@@ -1201,7 +1204,7 @@ void PhysicsServerExample::initPhysics()
int numMoving = 0; int numMoving = 0;
m_args[w].m_positions.resize(numMoving); m_args[w].m_positions.resize(numMoving);
m_args[w].m_physicsServerPtr = &m_physicsServer; m_args[w].m_physicsServerPtr = &m_physicsServer;
int index = 0; //int index = 0;
m_threadSupport->runTask(B3_THREAD_SCHEDULE_TASK, (void*) &this->m_args[w], w); m_threadSupport->runTask(B3_THREAD_SCHEDULE_TASK, (void*) &this->m_args[w], w);
@@ -1507,8 +1510,8 @@ extern btTransform gVRTrackingObjectTr;
void PhysicsServerExample::drawUserDebugLines() void PhysicsServerExample::drawUserDebugLines()
{ {
static char line0[1024]; //static char line0[1024];
static char line1[1024]; //static char line1[1024];
//draw all user-debug-lines //draw all user-debug-lines
@@ -1634,15 +1637,16 @@ void PhysicsServerExample::renderScene()
{ {
static int frameCount=0; static int frameCount=0;
static btScalar prevTime = m_clock.getTimeSeconds(); //static btScalar prevTime = m_clock.getTimeSeconds();
frameCount++; frameCount++;
#if 0
static btScalar worseFps = 1000000; static btScalar worseFps = 1000000;
int numFrames = 200; int numFrames = 200;
static int count = 0; static int count = 0;
count++; count++;
#if 0
if (0 == (count & 1)) if (0 == (count & 1))
{ {
btScalar curTime = m_clock.getTimeSeconds(); btScalar curTime = m_clock.getTimeSeconds();

View File

@@ -125,7 +125,6 @@ bool SharedMemoryCommandProcessor::processCommand(const struct SharedMemoryComma
bool SharedMemoryCommandProcessor::receiveStatus(struct SharedMemoryStatus& serverStatusOut, char* bufferServerToClient, int bufferSizeInBytes) bool SharedMemoryCommandProcessor::receiveStatus(struct SharedMemoryStatus& serverStatusOut, char* bufferServerToClient, int bufferSizeInBytes)
{ {
SharedMemoryStatus* stat = 0;
m_data->m_lastServerStatus.m_dataStream = 0; m_data->m_lastServerStatus.m_dataStream = 0;
m_data->m_lastServerStatus.m_numDataStreamBytes = 0; m_data->m_lastServerStatus.m_numDataStreamBytes = 0;

View File

@@ -546,7 +546,7 @@ void TinyRendererVisualShapeConverter::convertVisualShapes(int linkIndex, const
btAlignedObjectArray<GLInstanceVertex> vertices; btAlignedObjectArray<GLInstanceVertex> vertices;
btAlignedObjectArray<int> indices; btAlignedObjectArray<int> indices;
btTransform startTrans; startTrans.setIdentity(); btTransform startTrans; startTrans.setIdentity();
int graphicsIndex = -1; //int graphicsIndex = -1;
const UrdfVisual& vis = link->m_visualArray[v]; const UrdfVisual& vis = link->m_visualArray[v];
btTransform childTrans = vis.m_linkLocalFrame; btTransform childTrans = vis.m_linkLocalFrame;
@@ -660,7 +660,7 @@ int TinyRendererVisualShapeConverter::getVisualShapesData(int bodyUniqueId, int
break; break;
} }
} }
int count = 0; //int count = 0;
if (start >= 0) if (start >= 0)
{ {

View File

@@ -232,15 +232,15 @@ extern float eye[3];
extern int glutScreenWidth; extern int glutScreenWidth;
extern int glutScreenHeight; extern int glutScreenHeight;
static bool sDemoMode = false; //static bool sDemoMode = false;
const int maxProxies = 32766; const int maxProxies = 32766;
const int maxOverlap = 65535; //const int maxOverlap = 65535;
static btVector3* gGroundVertices=0; static btVector3* gGroundVertices=0;
static int* gGroundIndices=0; static int* gGroundIndices=0;
static btBvhTriangleMeshShape* trimeshShape =0; //static btBvhTriangleMeshShape* trimeshShape =0;
static btRigidBody* staticBody = 0; //static btRigidBody* staticBody = 0;
static float waveheight = 5.f; static float waveheight = 5.f;
const float TRIANGLE_SIZE=8.f; const float TRIANGLE_SIZE=8.f;
@@ -249,12 +249,12 @@ int current_demo=20;
#ifdef _DEBUG #ifdef _DEBUG
const int gNumObjects = 1; //const int gNumObjects = 1;
#else #else
const int gNumObjects = 1;//try this in release mode: 3000. never go above 16384, unless you increate maxNumObjects value in DemoApplication.cp //const int gNumObjects = 1;//try this in release mode: 3000. never go above 16384, unless you increate maxNumObjects value in DemoApplication.cp
#endif #endif
const int maxNumObjects = 32760; //const int maxNumObjects = 32760;
#define CUBE_HALF_EXTENTS 1.5 #define CUBE_HALF_EXTENTS 1.5
#define EXTRA_HEIGHT -10.f #define EXTRA_HEIGHT -10.f
@@ -1452,7 +1452,8 @@ static void Init_ClusterRobot(SoftDemo* pdemo)
ls.position=psb2->clusterCom(0);psb2->appendLinearJoint(ls,prb); ls.position=psb2->clusterCom(0);psb2->appendLinearJoint(ls,prb);
btBoxShape* pbox=new btBoxShape(btVector3(20,1,40)); btBoxShape* pbox=new btBoxShape(btVector3(20,1,40));
btRigidBody* pgrn=pdemo->createRigidBody(0,btTransform(btQuaternion(0,-SIMD_HALF_PI/2,0),btVector3(0,0,0)),pbox); btRigidBody* pgrn;
pgrn =pdemo->createRigidBody(0,btTransform(btQuaternion(0,-SIMD_HALF_PI/2,0),btVector3(0,0,0)),pbox);
pdemo->m_autocam=true; pdemo->m_autocam=true;

View File

@@ -486,7 +486,7 @@ void MatrixRmn::ComputeSVD( MatrixRmn& U, VectorRn& w, MatrixRmn& V ) const
&& U.NumRows==U.NumCols && V.NumRows==V.NumCols && U.NumRows==U.NumCols && V.NumRows==V.NumCols
&& w.GetLength()==Min(NumRows,NumCols) ); && w.GetLength()==Min(NumRows,NumCols) );
double temp=0.0; // double temp=0.0;
VectorRn& superDiag = VectorRn::GetWorkVector( w.GetLength()-1 ); // Some extra work space. Will get passed around. VectorRn& superDiag = VectorRn::GetWorkVector( w.GetLength()-1 ); // Some extra work space. Will get passed around.
// Choose larger of U, V to hold intermediate results // Choose larger of U, V to hold intermediate results

View File

@@ -23,7 +23,7 @@ subject to the following restrictions:
#include <math.h> #include <math.h>
#include "LinearR3.h" #include "LinearR3.h"
#if 0
/**************************************************************** /****************************************************************
Axes Axes
@@ -65,7 +65,7 @@ static float zy[] = {
static int zorder[] = { static int zorder[] = {
1, 2, 3, 4, -5, 6 1, 2, 3, 4, -5, 6
}; };
#endif
#define LENFRAC 0.10 #define LENFRAC 0.10
#define BASEFRAC 1.10 #define BASEFRAC 1.10
@@ -88,9 +88,9 @@ static int zorder[] = {
/* x, y, z, axes: */ /* x, y, z, axes: */
static float axx[3] = { 1., 0., 0. }; //static float axx[3] = { 1., 0., 0. };
static float ayy[3] = { 0., 1., 0. }; //static float ayy[3] = { 0., 1., 0. };
static float azz[3] = { 0., 0., 1. }; //static float azz[3] = { 0., 0., 1. };

View File

@@ -45,7 +45,7 @@ public:
double GetTheta() const { return theta; } double GetTheta() const { return theta; }
double AddToTheta( double& delta ) { double AddToTheta( double& delta ) {
double orgTheta = theta; //double orgTheta = theta;
theta += delta; theta += delta;
#if 0 #if 0
if (theta < minTheta) if (theta < minTheta)

View File

@@ -31,11 +31,11 @@ struct DepthShader : public IShader {
DepthShader(Model* model, Matrix& lightModelView, Matrix& projectionMat, Matrix& modelMat, Vec3f localScaling, float lightDistance) DepthShader(Model* model, Matrix& lightModelView, Matrix& projectionMat, Matrix& modelMat, Vec3f localScaling, float lightDistance)
:m_model(model), :m_model(model),
m_lightModelView(lightModelView),
m_projectionMat(projectionMat),
m_modelMat(modelMat), m_modelMat(modelMat),
m_localScaling(localScaling), m_projectionMat(projectionMat),
m_lightDistance(lightDistance) m_localScaling(localScaling),
m_lightModelView(lightModelView),
m_lightDistance(lightDistance)
{ {
m_invModelMat = m_modelMat.invert_transpose(); m_invModelMat = m_modelMat.invert_transpose();
} }
@@ -92,19 +92,21 @@ struct Shader : public IShader {
:m_model(model), :m_model(model),
m_light_dir_local(light_dir_local), m_light_dir_local(light_dir_local),
m_light_color(light_color), m_light_color(light_color),
m_ambient_coefficient(ambient_coefficient), m_modelMat(modelMat),
m_diffuse_coefficient(diffuse_coefficient), m_modelView1(modelView),
m_specular_coefficient(specular_coefficient), m_projectionMat(projectionMat),
m_modelView1(modelView), m_localScaling(localScaling),
m_lightModelView(lightModelView), m_lightModelView(lightModelView),
m_projectionMat(projectionMat), m_colorRGBA(colorRGBA),
m_modelMat(modelMat), m_viewportMat(viewportMat),
m_viewportMat(viewportMat), m_ambient_coefficient(ambient_coefficient),
m_localScaling(localScaling), m_diffuse_coefficient(diffuse_coefficient),
m_colorRGBA(colorRGBA), m_specular_coefficient(specular_coefficient),
m_width(width),
m_height(height), m_shadowBuffer(shadowBuffer),
m_shadowBuffer(shadowBuffer) m_width(width),
m_height(height)
{ {
m_invModelMat = m_modelMat.invert_transpose(); m_invModelMat = m_modelMat.invert_transpose();
} }
@@ -157,11 +159,12 @@ struct Shader : public IShader {
}; };
TinyRenderObjectData::TinyRenderObjectData(TGAImage& rgbColorBuffer,b3AlignedObjectArray<float>&depthBuffer,b3AlignedObjectArray<float>* shadowBuffer) TinyRenderObjectData::TinyRenderObjectData(TGAImage& rgbColorBuffer,b3AlignedObjectArray<float>&depthBuffer,b3AlignedObjectArray<float>* shadowBuffer)
:m_rgbColorBuffer(rgbColorBuffer), :
m_model(0),
m_rgbColorBuffer(rgbColorBuffer),
m_depthBuffer(depthBuffer), m_depthBuffer(depthBuffer),
m_shadowBuffer(shadowBuffer), m_shadowBuffer(shadowBuffer),
m_segmentationMaskBufferPtr(0), m_segmentationMaskBufferPtr(0),
m_model(0),
m_userData(0), m_userData(0),
m_userIndex(-1), m_userIndex(-1),
m_objectIndex(-1) m_objectIndex(-1)
@@ -180,11 +183,11 @@ m_objectIndex(-1)
} }
TinyRenderObjectData::TinyRenderObjectData(TGAImage& rgbColorBuffer,b3AlignedObjectArray<float>&depthBuffer, b3AlignedObjectArray<float>* shadowBuffer, b3AlignedObjectArray<int>* segmentationMaskBuffer, int objectIndex) TinyRenderObjectData::TinyRenderObjectData(TGAImage& rgbColorBuffer,b3AlignedObjectArray<float>&depthBuffer, b3AlignedObjectArray<float>* shadowBuffer, b3AlignedObjectArray<int>* segmentationMaskBuffer, int objectIndex)
:m_rgbColorBuffer(rgbColorBuffer), :m_model(0),
m_rgbColorBuffer(rgbColorBuffer),
m_depthBuffer(depthBuffer), m_depthBuffer(depthBuffer),
m_shadowBuffer(shadowBuffer), m_shadowBuffer(shadowBuffer),
m_segmentationMaskBufferPtr(segmentationMaskBuffer), m_segmentationMaskBufferPtr(segmentationMaskBuffer),
m_model(0),
m_userData(0), m_userData(0),
m_userIndex(-1), m_userIndex(-1),
m_objectIndex(objectIndex) m_objectIndex(objectIndex)
@@ -203,10 +206,10 @@ m_objectIndex(objectIndex)
} }
TinyRenderObjectData::TinyRenderObjectData(TGAImage& rgbColorBuffer,b3AlignedObjectArray<float>&depthBuffer) TinyRenderObjectData::TinyRenderObjectData(TGAImage& rgbColorBuffer,b3AlignedObjectArray<float>&depthBuffer)
:m_rgbColorBuffer(rgbColorBuffer), :m_model(0),
m_rgbColorBuffer(rgbColorBuffer),
m_depthBuffer(depthBuffer), m_depthBuffer(depthBuffer),
m_segmentationMaskBufferPtr(0), m_segmentationMaskBufferPtr(0),
m_model(0),
m_userData(0), m_userData(0),
m_userIndex(-1), m_userIndex(-1),
m_objectIndex(-1) m_objectIndex(-1)
@@ -225,10 +228,10 @@ m_objectIndex(-1)
} }
TinyRenderObjectData::TinyRenderObjectData(TGAImage& rgbColorBuffer,b3AlignedObjectArray<float>&depthBuffer, b3AlignedObjectArray<int>* segmentationMaskBuffer, int objectIndex) TinyRenderObjectData::TinyRenderObjectData(TGAImage& rgbColorBuffer,b3AlignedObjectArray<float>&depthBuffer, b3AlignedObjectArray<int>* segmentationMaskBuffer, int objectIndex)
:m_rgbColorBuffer(rgbColorBuffer), :m_model(0),
m_rgbColorBuffer(rgbColorBuffer),
m_depthBuffer(depthBuffer), m_depthBuffer(depthBuffer),
m_segmentationMaskBufferPtr(segmentationMaskBuffer), m_segmentationMaskBufferPtr(segmentationMaskBuffer),
m_model(0),
m_userData(0), m_userData(0),
m_userIndex(-1), m_userIndex(-1),
m_objectIndex(objectIndex) m_objectIndex(objectIndex)

View File

@@ -457,8 +457,8 @@ void Dof6ConstraintTutorial::animate()
/////// servo motor: flip its target periodically /////// servo motor: flip its target periodically
#ifdef USE_6DOF2 #ifdef USE_6DOF2
static float servoNextFrame = -1; static float servoNextFrame = -1;
btScalar pos = m_data->m_ServoMotorConstraint->getRotationalLimitMotor(2)->m_currentPosition; //btScalar pos = m_data->m_ServoMotorConstraint->getRotationalLimitMotor(2)->m_currentPosition;
btScalar target = m_data->m_ServoMotorConstraint->getRotationalLimitMotor(2)->m_servoTarget; //btScalar target = m_data->m_ServoMotorConstraint->getRotationalLimitMotor(2)->m_servoTarget;
if(servoNextFrame < 0) if(servoNextFrame < 0)
{ {
m_data->m_ServoMotorConstraint->getRotationalLimitMotor(2)->m_servoTarget *= -1; m_data->m_ServoMotorConstraint->getRotationalLimitMotor(2)->m_servoTarget *= -1;
@@ -510,7 +510,7 @@ void Dof6ConstraintTutorial::stepSimulation(float deltaTime)
//animate(); //animate();
float time = m_data->m_timeSeriesCanvas->getCurrentTime(); //float time = m_data->m_timeSeriesCanvas->getCurrentTime();
float prevPos = m_data->m_TranslateSpringBody->getWorldTransform().getOrigin().x(); float prevPos = m_data->m_TranslateSpringBody->getWorldTransform().getOrigin().x();
m_dynamicsWorld->stepSimulation(deltaTime); m_dynamicsWorld->stepSimulation(deltaTime);

View File

@@ -292,11 +292,11 @@ public:
:m_app(guiHelper->getAppInterface()), :m_app(guiHelper->getAppInterface()),
m_guiHelper(guiHelper), m_guiHelper(guiHelper),
m_tutorialIndex(tutorialIndex), m_tutorialIndex(tutorialIndex),
m_stage(0),
m_counter(0),
m_timeSeriesCanvas0(0), m_timeSeriesCanvas0(0),
m_timeSeriesCanvas1(0) m_timeSeriesCanvas1(0),
{ m_stage(0),
m_counter(0)
{
int numBodies = 1; int numBodies = 1;
m_app->setUpAxis(1); m_app->setUpAxis(1);

View File

@@ -158,9 +158,9 @@ static btScalar loadMass = 350.f;//
#endif #endif
static int rightIndex = 0; //static int rightIndex = 0;
static int upIndex = 1; //static int upIndex = 1;
static int forwardIndex = 2; //static int forwardIndex = 2;
static btVector3 wheelDirectionCS0(0,-1,0); static btVector3 wheelDirectionCS0(0,-1,0);
static btVector3 wheelAxleCS(-1,0,0); static btVector3 wheelAxleCS(-1,0,0);
@@ -173,8 +173,8 @@ static bool useMCLPSolver = false;//true;
#include "Hinge2Vehicle.h" #include "Hinge2Vehicle.h"
static const int maxProxies = 32766; //static const int maxProxies = 32766;
static const int maxOverlap = 65535; //static const int maxOverlap = 65535;
static float gEngineForce = 0.f; static float gEngineForce = 0.f;
@@ -182,21 +182,21 @@ static float defaultBreakingForce = 10.f;
static float gBreakingForce = 100.f; static float gBreakingForce = 100.f;
static float maxEngineForce = 1000.f;//this should be engine/velocity dependent static float maxEngineForce = 1000.f;//this should be engine/velocity dependent
static float maxBreakingForce = 100.f; //static float maxBreakingForce = 100.f;
static float gVehicleSteering = 0.f; static float gVehicleSteering = 0.f;
static float steeringIncrement = 0.04f; static float steeringIncrement = 0.04f;
static float steeringClamp = 0.3f; static float steeringClamp = 0.3f;
static float wheelRadius = 0.5f; static float wheelRadius = 0.5f;
static float wheelWidth = 0.4f; static float wheelWidth = 0.4f;
static float wheelFriction = 1000;//BT_LARGE_FLOAT; //static float wheelFriction = 1000;//BT_LARGE_FLOAT;
static float suspensionStiffness = 20.f; //static float suspensionStiffness = 20.f;
static float suspensionDamping = 2.3f; //static float suspensionDamping = 2.3f;
static float suspensionCompression = 4.4f; //static float suspensionCompression = 4.4f;
static float rollInfluence = 0.1f;//1.0f; //static float rollInfluence = 0.1f;//1.0f;
static btScalar suspensionRestLength(0.6); //static btScalar suspensionRestLength(0.6);
#define CUBE_HALF_EXTENTS 1 #define CUBE_HALF_EXTENTS 1
@@ -209,8 +209,8 @@ static btScalar suspensionRestLength(0.6);
Hinge2Vehicle::Hinge2Vehicle(struct GUIHelperInterface* helper) Hinge2Vehicle::Hinge2Vehicle(struct GUIHelperInterface* helper)
:CommonRigidBodyBase(helper), :CommonRigidBodyBase(helper),
m_guiHelper(helper),
m_carChassis(0), m_carChassis(0),
m_guiHelper(helper),
m_liftBody(0), m_liftBody(0),
m_forkBody(0), m_forkBody(0),
m_loadBody(0), m_loadBody(0),
@@ -378,10 +378,10 @@ tr.setOrigin(btVector3(0,-3,0));
m_wheelShape = new btCylinderShapeX(btVector3(wheelWidth,wheelRadius,wheelRadius)); m_wheelShape = new btCylinderShapeX(btVector3(wheelWidth,wheelRadius,wheelRadius));
const float position[4]={0,10,10,0}; //const float position[4]={0,10,10,0};
const float quaternion[4]={0,0,0,1}; //const float quaternion[4]={0,0,0,1};
const float color[4]={0,1,0,1}; //const float color[4]={0,1,0,1};
const float scaling[4] = {1,1,1,1}; //const float scaling[4] = {1,1,1,1};
btVector3 wheelPos[4] = { btVector3 wheelPos[4] = {
btVector3(btScalar(-1.), btScalar(-0.25), btScalar(1.25)), btVector3(btScalar(-1.), btScalar(-0.25), btScalar(1.25)),

View File

@@ -354,7 +354,6 @@ static PyObject* pybullet_disconnectPhysicsServer(PyObject* self,
} }
static PyObject* pybullet_saveWorld(PyObject* self, PyObject* args,PyObject *keywds) { static PyObject* pybullet_saveWorld(PyObject* self, PyObject* args,PyObject *keywds) {
int size = PySequence_Size(args);
const char* worldFileName = ""; const char* worldFileName = "";
b3PhysicsClientHandle sm = 0; b3PhysicsClientHandle sm = 0;
@@ -398,7 +397,6 @@ static PyObject* pybullet_saveWorld(PyObject* self, PyObject* args,PyObject *key
#define MAX_SDF_BODIES 512 #define MAX_SDF_BODIES 512
static PyObject* pybullet_loadBullet(PyObject* self, PyObject* args,PyObject *keywds) static PyObject* pybullet_loadBullet(PyObject* self, PyObject* args,PyObject *keywds)
{ {
int size = PySequence_Size(args);
const char* bulletFileName = ""; const char* bulletFileName = "";
b3SharedMemoryStatusHandle statusHandle; b3SharedMemoryStatusHandle statusHandle;
int statusType; int statusType;
@@ -452,7 +450,6 @@ static PyObject* pybullet_loadBullet(PyObject* self, PyObject* args,PyObject *ke
static PyObject* pybullet_saveBullet(PyObject* self, PyObject* args, PyObject* keywds) static PyObject* pybullet_saveBullet(PyObject* self, PyObject* args, PyObject* keywds)
{ {
int size = PySequence_Size(args);
const char* bulletFileName = ""; const char* bulletFileName = "";
b3SharedMemoryStatusHandle statusHandle; b3SharedMemoryStatusHandle statusHandle;
int statusType; int statusType;
@@ -489,7 +486,6 @@ static PyObject* pybullet_saveBullet(PyObject* self, PyObject* args, PyObject* k
static PyObject* pybullet_loadMJCF(PyObject* self, PyObject* args, PyObject* keywds) static PyObject* pybullet_loadMJCF(PyObject* self, PyObject* args, PyObject* keywds)
{ {
int size = PySequence_Size(args);
const char* mjcfFileName = ""; const char* mjcfFileName = "";
b3SharedMemoryStatusHandle statusHandle; b3SharedMemoryStatusHandle statusHandle;
int statusType; int statusType;
@@ -614,7 +610,6 @@ static PyObject* pybullet_setPhysicsEngineParameter(PyObject* self, PyObject* ar
// loadURDF(pos_x, pos_y, pos_z, orn_x, orn_y, orn_z, orn_w) // loadURDF(pos_x, pos_y, pos_z, orn_x, orn_y, orn_z, orn_w)
static PyObject* pybullet_loadURDF(PyObject* self, PyObject* args, PyObject *keywds) static PyObject* pybullet_loadURDF(PyObject* self, PyObject* args, PyObject *keywds)
{ {
int size = PySequence_Size(args);
int physicsClientId = 0; int physicsClientId = 0;
static char *kwlist[] = { "fileName", "basePosition", "baseOrientation", "useMaximalCoordinates","useFixedBase","physicsClientId", NULL }; static char *kwlist[] = { "fileName", "basePosition", "baseOrientation", "useMaximalCoordinates","useFixedBase","physicsClientId", NULL };
@@ -753,7 +748,6 @@ b3PhysicsClientHandle sm=0;
static PyObject* pybullet_loadSDF(PyObject* self, PyObject* args, PyObject *keywds) { static PyObject* pybullet_loadSDF(PyObject* self, PyObject* args, PyObject *keywds) {
const char* sdfFileName = ""; const char* sdfFileName = "";
int size = PySequence_Size(args);
int numBodies = 0; int numBodies = 0;
int i; int i;
int bodyIndicesOut[MAX_SDF_BODIES]; int bodyIndicesOut[MAX_SDF_BODIES];
@@ -1577,8 +1571,7 @@ static PyObject* pybullet_getBodyInfo(PyObject* self, PyObject* args, PyObject*
{ {
int bodyUniqueId= -1; int bodyUniqueId= -1;
int numJoints = 0; b3PhysicsClientHandle sm = 0;
b3PhysicsClientHandle sm = 0;
int physicsClientId = 0; int physicsClientId = 0;
static char *kwlist[] = { "bodyUniqueId", "physicsClientId", NULL }; static char *kwlist[] = { "bodyUniqueId", "physicsClientId", NULL };
@@ -2128,15 +2121,13 @@ b3PhysicsClientHandle sm = 0;
static PyObject* pybullet_addUserDebugText(PyObject* self, PyObject* args, PyObject *keywds) static PyObject* pybullet_addUserDebugText(PyObject* self, PyObject* args, PyObject *keywds)
{ {
int size = PySequence_Size(args);
b3SharedMemoryCommandHandle commandHandle; b3SharedMemoryCommandHandle commandHandle;
b3SharedMemoryStatusHandle statusHandle; b3SharedMemoryStatusHandle statusHandle;
int statusType; int statusType;
int res = 0; int res = 0;
PyObject* pyResultList = 0; char* text;
char* text;
double posXYZ[3]; double posXYZ[3];
double colorRGB[3]={1,1,1}; double colorRGB[3]={1,1,1};
@@ -2198,15 +2189,13 @@ static PyObject* pybullet_addUserDebugText(PyObject* self, PyObject* args, PyObj
static PyObject* pybullet_addUserDebugLine(PyObject* self, PyObject* args, PyObject *keywds) static PyObject* pybullet_addUserDebugLine(PyObject* self, PyObject* args, PyObject *keywds)
{ {
int size = PySequence_Size(args);
b3SharedMemoryCommandHandle commandHandle; b3SharedMemoryCommandHandle commandHandle;
b3SharedMemoryStatusHandle statusHandle; b3SharedMemoryStatusHandle statusHandle;
int statusType; int statusType;
int res = 0; int res = 0;
PyObject* pyResultList = 0;
double fromXYZ[3]; double fromXYZ[3];
double toXYZ[3]; double toXYZ[3];
double colorRGB[3]={1,1,1}; double colorRGB[3]={1,1,1};
@@ -2704,7 +2693,6 @@ static PyObject* pybullet_getVisualShapeData(PyObject* self, PyObject* args, PyO
PyTuple_SetItem(visualShapeObList, 6, vec); PyTuple_SetItem(visualShapeObList, 6, vec);
} }
visualShapeInfo.m_visualShapeData[0].m_rgbaColor[0];
PyTuple_SetItem(pyResultList, i, visualShapeObList); PyTuple_SetItem(pyResultList, i, visualShapeObList);
} }
@@ -2767,7 +2755,6 @@ static PyObject* pybullet_resetVisualShapeData(PyObject* self, PyObject* args,Py
static PyObject* pybullet_loadTexture(PyObject* self, PyObject* args, PyObject* keywds) static PyObject* pybullet_loadTexture(PyObject* self, PyObject* args, PyObject* keywds)
{ {
int size = PySequence_Size(args);
const char* filename = 0; const char* filename = 0;
b3SharedMemoryCommandHandle commandHandle; b3SharedMemoryCommandHandle commandHandle;
b3SharedMemoryStatusHandle statusHandle; b3SharedMemoryStatusHandle statusHandle;
@@ -2970,7 +2957,6 @@ static PyObject* pybullet_getOverlappingObjects(PyObject* self, PyObject* args,
static PyObject* pybullet_getClosestPointData(PyObject* self, PyObject* args, PyObject *keywds) static PyObject* pybullet_getClosestPointData(PyObject* self, PyObject* args, PyObject *keywds)
{ {
int size = PySequence_Size(args);
int bodyUniqueIdA = -1; int bodyUniqueIdA = -1;
int bodyUniqueIdB = -1; int bodyUniqueIdB = -1;
int linkIndexA = -2; int linkIndexA = -2;
@@ -2982,7 +2968,6 @@ static PyObject* pybullet_getClosestPointData(PyObject* self, PyObject* args, Py
struct b3ContactInformation contactPointData; struct b3ContactInformation contactPointData;
b3SharedMemoryStatusHandle statusHandle; b3SharedMemoryStatusHandle statusHandle;
int statusType; int statusType;
PyObject* pyResultList = 0;
int physicsClientId = 0; int physicsClientId = 0;
b3PhysicsClientHandle sm = 0; b3PhysicsClientHandle sm = 0;
static char *kwlist[] = { "bodyA", "bodyB", "distance", "linkIndexA","linkIndexB","physicsClientId", NULL }; static char *kwlist[] = { "bodyA", "bodyB", "distance", "linkIndexA","linkIndexB","physicsClientId", NULL };
@@ -3111,9 +3096,6 @@ static PyObject* pybullet_updateUserConstraint(PyObject* self, PyObject* args, P
static PyObject* pybullet_createUserConstraint(PyObject* self, PyObject* args, PyObject *keywds) static PyObject* pybullet_createUserConstraint(PyObject* self, PyObject* args, PyObject *keywds)
{ {
int size = PySequence_Size(args);
int bodyUniqueIdA = -1;
int bodyUniqueIdB = -1;
b3SharedMemoryCommandHandle commandHandle; b3SharedMemoryCommandHandle commandHandle;
int parentBodyUniqueId=-1; int parentBodyUniqueId=-1;
@@ -3135,7 +3117,6 @@ static PyObject* pybullet_createUserConstraint(PyObject* self, PyObject* args, P
struct b3JointInfo jointInfo; struct b3JointInfo jointInfo;
b3SharedMemoryStatusHandle statusHandle; b3SharedMemoryStatusHandle statusHandle;
int statusType; int statusType;
PyObject* pyResultList = 0;
int physicsClientId = 0; int physicsClientId = 0;
b3PhysicsClientHandle sm = 0; b3PhysicsClientHandle sm = 0;
static char *kwlist[] = { "parentBodyUniqueId", "parentLinkIndex", static char *kwlist[] = { "parentBodyUniqueId", "parentLinkIndex",
@@ -3218,7 +3199,6 @@ static PyObject* pybullet_createUserConstraint(PyObject* self, PyObject* args, P
} }
static PyObject* pybullet_getContactPointData(PyObject* self, PyObject* args, PyObject *keywds) { static PyObject* pybullet_getContactPointData(PyObject* self, PyObject* args, PyObject *keywds) {
int size = PySequence_Size(args);
int bodyUniqueIdA = -1; int bodyUniqueIdA = -1;
int bodyUniqueIdB = -1; int bodyUniqueIdB = -1;
@@ -3226,7 +3206,6 @@ static PyObject* pybullet_getContactPointData(PyObject* self, PyObject* args, Py
struct b3ContactInformation contactPointData; struct b3ContactInformation contactPointData;
b3SharedMemoryStatusHandle statusHandle; b3SharedMemoryStatusHandle statusHandle;
int statusType; int statusType;
PyObject* pyResultList = 0;
static char *kwlist[] = { "bodyA", "bodyB","physicsClientId", NULL }; static char *kwlist[] = { "bodyA", "bodyB","physicsClientId", NULL };
@@ -3273,7 +3252,6 @@ static PyObject* pybullet_getCameraImage(PyObject* self, PyObject* args, PyObjec
struct b3CameraImageData imageData; struct b3CameraImageData imageData;
PyObject* objViewMat = 0, *objProjMat = 0, *lightDirObj = 0, *lightColorObj = 0; PyObject* objViewMat = 0, *objProjMat = 0, *lightDirObj = 0, *lightColorObj = 0;
int width, height; int width, height;
int size = PySequence_Size(args);
float viewMatrix[16]; float viewMatrix[16];
float projectionMatrix[16]; float projectionMatrix[16];
float lightDir[3]; float lightDir[3];
@@ -3852,8 +3830,7 @@ static PyObject* pybullet_applyExternalForce(PyObject* self, PyObject* args,PyOb
b3SharedMemoryCommandHandle command; b3SharedMemoryCommandHandle command;
b3SharedMemoryStatusHandle statusHandle; b3SharedMemoryStatusHandle statusHandle;
int size = PySequence_Size(args); int physicsClientId = 0;
int physicsClientId = 0;
b3PhysicsClientHandle sm = 0; b3PhysicsClientHandle sm = 0;
static char *kwlist[] = { "objectUniqueId", "linkIndex", static char *kwlist[] = { "objectUniqueId", "linkIndex",
"forceObj", "posObj", "flags", "physicsClientId", NULL }; "forceObj", "posObj", "flags", "physicsClientId", NULL };
@@ -4156,7 +4133,6 @@ static PyObject* pybullet_calculateInverseKinematics(PyObject* self,
{ {
int szInBytes = sizeof(double) * numJoints; int szInBytes = sizeof(double) * numJoints;
int i; int i;
PyObject* pylist = 0;
lowerLimits = (double*)malloc(szInBytes); lowerLimits = (double*)malloc(szInBytes);
upperLimits = (double*)malloc(szInBytes); upperLimits = (double*)malloc(szInBytes);
jointRanges = (double*)malloc(szInBytes); jointRanges = (double*)malloc(szInBytes);

View File

@@ -1021,9 +1021,10 @@ inline void b3DynamicBvh::rayTest( const b3DbvtNode* root,
unsigned int signs[3] = { rayDirectionInverse[0] < 0.0, rayDirectionInverse[1] < 0.0, rayDirectionInverse[2] < 0.0}; unsigned int signs[3] = { rayDirectionInverse[0] < 0.0, rayDirectionInverse[1] < 0.0, rayDirectionInverse[2] < 0.0};
b3Scalar lambda_max = rayDir.dot(rayTo-rayFrom); b3Scalar lambda_max = rayDir.dot(rayTo-rayFrom);
#ifdef COMPARE_BTRAY_AABB2
b3Vector3 resultNormal; b3Vector3 resultNormal;
#endif//COMPARE_BTRAY_AABB2
b3AlignedObjectArray<const b3DbvtNode*> stack; b3AlignedObjectArray<const b3DbvtNode*> stack;
int depth=1; int depth=1;

View File

@@ -164,8 +164,8 @@ b3BroadphaseProxy* b3DynamicBvhBroadphase::createProxy( const b3Vector3& aabb
const b3Vector3& aabbMax, const b3Vector3& aabbMax,
int objectId, int objectId,
void* userPtr, void* userPtr,
short int collisionFilterGroup, int collisionFilterGroup,
short int collisionFilterMask) int collisionFilterMask)
{ {
b3DbvtProxy* mem = &m_proxies[objectId]; b3DbvtProxy* mem = &m_proxies[objectId];
b3DbvtProxy* proxy=new(mem) b3DbvtProxy( aabbMin,aabbMax,userPtr, b3DbvtProxy* proxy=new(mem) b3DbvtProxy( aabbMin,aabbMax,userPtr,

View File

@@ -61,9 +61,8 @@ B3_DECLARE_ALIGNED_ALLOCATOR();
//Usually the client b3CollisionObject or Rigidbody class //Usually the client b3CollisionObject or Rigidbody class
void* m_clientObject; void* m_clientObject;
short int m_collisionFilterGroup; int m_collisionFilterGroup;
short int m_collisionFilterMask; int m_collisionFilterMask;
void* m_multiSapParentProxy;
int m_uniqueId;//m_uniqueId is introduced for paircache. could get rid of this, by calculating the address offset etc. int m_uniqueId;//m_uniqueId is introduced for paircache. could get rid of this, by calculating the address offset etc.
b3Vector3 m_aabbMin; b3Vector3 m_aabbMin;
@@ -75,18 +74,17 @@ B3_DECLARE_ALIGNED_ALLOCATOR();
} }
//used for memory pools //used for memory pools
b3BroadphaseProxy() :m_clientObject(0),m_multiSapParentProxy(0) b3BroadphaseProxy() :m_clientObject(0)
{ {
} }
b3BroadphaseProxy(const b3Vector3& aabbMin,const b3Vector3& aabbMax,void* userPtr,short int collisionFilterGroup, short int collisionFilterMask,void* multiSapParentProxy=0) b3BroadphaseProxy(const b3Vector3& aabbMin,const b3Vector3& aabbMax,void* userPtr, int collisionFilterGroup, int collisionFilterMask)
:m_clientObject(userPtr), :m_clientObject(userPtr),
m_collisionFilterGroup(collisionFilterGroup), m_collisionFilterGroup(collisionFilterGroup),
m_collisionFilterMask(collisionFilterMask), m_collisionFilterMask(collisionFilterMask),
m_aabbMin(aabbMin), m_aabbMin(aabbMin),
m_aabbMax(aabbMax) m_aabbMax(aabbMax)
{ {
m_multiSapParentProxy = multiSapParentProxy;
} }
}; };
@@ -107,7 +105,7 @@ struct b3DbvtProxy : b3BroadphaseProxy
/* ctor */ /* ctor */
explicit b3DbvtProxy() {} explicit b3DbvtProxy() {}
b3DbvtProxy(const b3Vector3& aabbMin,const b3Vector3& aabbMax,void* userPtr,short int collisionFilterGroup, short int collisionFilterMask) : b3DbvtProxy(const b3Vector3& aabbMin,const b3Vector3& aabbMax,void* userPtr, int collisionFilterGroup, int collisionFilterMask) :
b3BroadphaseProxy(aabbMin,aabbMax,userPtr,collisionFilterGroup,collisionFilterMask) b3BroadphaseProxy(aabbMin,aabbMax,userPtr,collisionFilterGroup,collisionFilterMask)
{ {
links[0]=links[1]=0; links[0]=links[1]=0;
@@ -165,7 +163,7 @@ struct b3DynamicBvhBroadphase
void optimize(); void optimize();
/* b3BroadphaseInterface Implementation */ /* b3BroadphaseInterface Implementation */
b3BroadphaseProxy* createProxy(const b3Vector3& aabbMin,const b3Vector3& aabbMax,int objectIndex,void* userPtr,short int collisionFilterGroup,short int collisionFilterMask); b3BroadphaseProxy* createProxy(const b3Vector3& aabbMin,const b3Vector3& aabbMax,int objectIndex,void* userPtr, int collisionFilterGroup, int collisionFilterMask);
virtual void destroyProxy(b3BroadphaseProxy* proxy,b3Dispatcher* dispatcher); virtual void destroyProxy(b3BroadphaseProxy* proxy,b3Dispatcher* dispatcher);
virtual void setAabb(int objectId,const b3Vector3& aabbMin,const b3Vector3& aabbMax,b3Dispatcher* dispatcher); virtual void setAabb(int objectId,const b3Vector3& aabbMin,const b3Vector3& aabbMax,b3Dispatcher* dispatcher);
virtual void rayTest(const b3Vector3& rayFrom,const b3Vector3& rayTo, b3BroadphaseRayCallback& rayCallback, const b3Vector3& aabbMin=b3MakeVector3(0,0,0), const b3Vector3& aabbMax = b3MakeVector3(0,0,0)); virtual void rayTest(const b3Vector3& rayFrom,const b3Vector3& rayTo, b3BroadphaseRayCallback& rayCallback, const b3Vector3& aabbMin=b3MakeVector3(0,0,0), const b3Vector3& aabbMax = b3MakeVector3(0,0,0));

View File

@@ -32,8 +32,8 @@ int b3g_findPairs =0;
b3HashedOverlappingPairCache::b3HashedOverlappingPairCache(): b3HashedOverlappingPairCache::b3HashedOverlappingPairCache():
m_overlapFilterCallback(0), m_overlapFilterCallback(0)
m_blockedForChanges(false) //, m_blockedForChanges(false)
{ {
int initialAllocatedSize= 2; int initialAllocatedSize= 2;
m_overlappingPairArray.reserve(initialAllocatedSize); m_overlappingPairArray.reserve(initialAllocatedSize);

View File

@@ -98,7 +98,7 @@ class b3HashedOverlappingPairCache : public b3OverlappingPairCache
{ {
b3BroadphasePairArray m_overlappingPairArray; b3BroadphasePairArray m_overlappingPairArray;
b3OverlapFilterCallback* m_overlapFilterCallback; b3OverlapFilterCallback* m_overlapFilterCallback;
bool m_blockedForChanges; // bool m_blockedForChanges;
public: public:

View File

@@ -108,7 +108,7 @@ __kernel void clipFacesAndFindContactsKernel( __global const b3Float4* sepa
int closestFaceA = clippingFaces[pairIndex].x; int closestFaceA = clippingFaces[pairIndex].x;
int closestFaceB = clippingFaces[pairIndex].y; // int closestFaceB = clippingFaces[pairIndex].y;
int numVertsInA = clippingFaces[pairIndex].z; int numVertsInA = clippingFaces[pairIndex].z;
int numVertsInB = clippingFaces[pairIndex].w; int numVertsInB = clippingFaces[pairIndex].w;

View File

@@ -112,7 +112,7 @@ inline int b3ClipFaceAgainstHull(const b3Float4& separatingNormal, const b3Conve
b3GpuFace polyA = facesA[hullA->m_faceOffset+closestFaceA]; b3GpuFace polyA = facesA[hullA->m_faceOffset+closestFaceA];
// clip polygon to back of planes of all faces of hull A that are adjacent to witness face // clip polygon to back of planes of all faces of hull A that are adjacent to witness face
int numContacts = numWorldVertsB1; //int numContacts = numWorldVertsB1;
int numVerticesA = polyA.m_numIndices; int numVerticesA = polyA.m_numIndices;
for(int e0=0;e0<numVerticesA;e0++) for(int e0=0;e0<numVerticesA;e0++)
{ {
@@ -193,7 +193,7 @@ inline int b3ClipHullAgainstHull(const b3Float4& separatingNormal,
B3_PROFILE("clipHullAgainstHull"); B3_PROFILE("clipHullAgainstHull");
float curMaxDist=maxDist; //float curMaxDist=maxDist;
int closestFaceB=-1; int closestFaceB=-1;
float dmax = -FLT_MAX; float dmax = -FLT_MAX;
@@ -399,7 +399,7 @@ inline int b3ClipHullHullSingle(
contact.m_frictionCoeffCmp = 45874; contact.m_frictionCoeffCmp = 45874;
contact.m_restituitionCoeffCmp = 0; contact.m_restituitionCoeffCmp = 0;
float distance = 0.f; // float distance = 0.f;
for (int p=0;p<numPoints;p++) for (int p=0;p<numPoints;p++)
{ {
contact.m_worldPosB[p] = contactsOut[contactIdx.s[p]];//check if it is actually on B contact.m_worldPosB[p] = contactsOut[contactIdx.s[p]];//check if it is actually on B
@@ -461,9 +461,6 @@ inline int b3ContactConvexConvexSAT(
//printf("numvertsB = %d\n",hullB.m_numVertices); //printf("numvertsB = %d\n",hullB.m_numVertices);
// b3Float4 contactsOut[B3_MAX_VERTS];
int contactCapacity = B3_MAX_VERTS;
int numContactsOut=0;
#ifdef _WIN32 #ifdef _WIN32

View File

@@ -323,7 +323,7 @@ bool b3FindSeparatingAxisEdgeEdge( const b3ConvexPolyhedronData* hullA, __global
b3Float4 posB = posB1; b3Float4 posB = posB1;
posB.w = 0.f; posB.w = 0.f;
int curPlaneTests=0; // int curPlaneTests=0;
int curEdgeEdge = 0; int curEdgeEdge = 0;
// Test edges // Test edges
@@ -577,7 +577,7 @@ __kernel void b3FindConcaveSeparatingAxisKernel( __global b3Int4* concavePairs
hasSeparatingNormals[i] = 0; hasSeparatingNormals[i] = 0;
int numFacesA = convexShapes[shapeIndexA].m_numFaces; // int numFacesA = convexShapes[shapeIndexA].m_numFaces;
int numActualConcaveConvexTests = 0; int numActualConcaveConvexTests = 0;
int f = concavePairs[i].z; int f = concavePairs[i].z;
@@ -620,7 +620,7 @@ __kernel void b3FindConcaveSeparatingAxisKernel( __global b3Int4* concavePairs
int hasSeparatingAxis=5; int hasSeparatingAxis=5;
b3Float4 sepAxis=b3MakeFloat4(1,2,3,4); b3Float4 sepAxis=b3MakeFloat4(1,2,3,4);
int localCC=0; // int localCC=0;
numActualConcaveConvexTests++; numActualConcaveConvexTests++;
//a triangle has 3 unique edges //a triangle has 3 unique edges
@@ -665,7 +665,7 @@ __kernel void b3FindConcaveSeparatingAxisKernel( __global b3Int4* concavePairs
indicesA[5]=0; indicesA[5]=0;
curUsedIndices+=3; curUsedIndices+=3;
float c = b3Dot(normal,verticesA[0]); float c = b3Dot(normal,verticesA[0]);
float c1 = -face.m_plane.w; // float c1 = -face.m_plane.w;
facesA[fidx].m_plane.x = -normal.x; facesA[fidx].m_plane.x = -normal.x;
facesA[fidx].m_plane.y = -normal.y; facesA[fidx].m_plane.y = -normal.y;
facesA[fidx].m_plane.z = -normal.z; facesA[fidx].m_plane.z = -normal.z;

View File

@@ -16,7 +16,7 @@ inline void b3ProjectAxis(const b3ConvexPolyhedronData& hull, const b3Float4& p
{ {
//b3Vector3 pt = trans * vertices[m_vertexOffset+i]; //b3Vector3 pt = trans * vertices[m_vertexOffset+i];
//b3Scalar dp = pt.dot(dir); //b3Scalar dp = pt.dot(dir);
b3Vector3 vertex = vertices[hull.m_vertexOffset+i]; //b3Vector3 vertex = vertices[hull.m_vertexOffset+i];
b3Scalar dp = b3Dot3F4((b3Float4&)vertices[hull.m_vertexOffset+i],localDir); b3Scalar dp = b3Dot3F4((b3Float4&)vertices[hull.m_vertexOffset+i],localDir);
//b3Assert(dp==dpL); //b3Assert(dp==dpL);
if(dp < min) min = dp; if(dp < min) min = dp;

View File

@@ -180,7 +180,7 @@ B3_STATIC void b3MprConvexSupport(int pairIndex,int bodyIndex, b3ConstArray(b3R
{ {
b3Float4 supVec = b3MakeFloat4(0,0,0,0); // b3Float4 supVec = b3MakeFloat4(0,0,0,0);
float maxDot = -B3_LARGE_FLOAT; float maxDot = -B3_LARGE_FLOAT;
if( 0 < hull->m_numVertices ) if( 0 < hull->m_numVertices )

View File

@@ -142,8 +142,9 @@ int getNumContacts(b3Contact4* contact)
} }
b3PgsJacobiSolver::b3PgsJacobiSolver(bool usePgs) b3PgsJacobiSolver::b3PgsJacobiSolver(bool usePgs)
:m_btSeed2(0),m_usePgs(usePgs), :m_usePgs(usePgs),
m_numSplitImpulseRecoveries(0) m_numSplitImpulseRecoveries(0),
m_btSeed2(0)
{ {
} }
@@ -1084,7 +1085,7 @@ b3Scalar b3PgsJacobiSolver::solveGroupCacheFriendlySetup(b3RigidBodyData* bodies
m_deltaAngularVelocities.resize(0); m_deltaAngularVelocities.resize(0);
m_deltaAngularVelocities.resize(numBodies,b3MakeVector3(0,0,0)); m_deltaAngularVelocities.resize(numBodies,b3MakeVector3(0,0,0));
int totalBodies = 0; //int totalBodies = 0;
for (int i=0;i<numConstraints;i++) for (int i=0;i<numConstraints;i++)
{ {

View File

@@ -83,7 +83,7 @@ void b3Point2PointConstraint::getInfo2NonVirtual (b3ConstraintInfo2* info, const
info->m_J1linearAxis[2*info->rowskip+2] = 1; info->m_J1linearAxis[2*info->rowskip+2] = 1;
b3Vector3 a1 = body0_trans.getBasis()*getPivotInA(); b3Vector3 a1 = body0_trans.getBasis()*getPivotInA();
b3Vector3 a1a = b3QuatRotate(body0_trans.getRotation(),getPivotInA()); //b3Vector3 a1a = b3QuatRotate(body0_trans.getRotation(),getPivotInA());
{ {
b3Vector3* angular0 = (b3Vector3*)(info->m_J1angularAxis); b3Vector3* angular0 = (b3Vector3*)(info->m_J1angularAxis);

View File

@@ -254,9 +254,12 @@ struct b3SolveTask// : public ThreadPool::Task
int maxNumBatches, int maxNumBatches,
b3AlignedObjectArray<int>* wgUsedBodies, int curWgidx b3AlignedObjectArray<int>* wgUsedBodies, int curWgidx
) )
: m_bodies( bodies ), m_shapes( shapes ), m_constraints( constraints ), m_start( start ), m_nConstraints( nConstraints ), : m_bodies( bodies ), m_shapes( shapes ), m_constraints( constraints ),
m_solveFriction( true ),m_maxNumBatches(maxNumBatches), m_wgUsedBodies(wgUsedBodies),m_curWgidx(curWgidx),
m_wgUsedBodies(wgUsedBodies),m_curWgidx(curWgidx) m_start( start ),
m_nConstraints( nConstraints ),
m_solveFriction( true ),
m_maxNumBatches(maxNumBatches)
{} {}
unsigned short int getType(){ return 0; } unsigned short int getType(){ return 0; }
@@ -281,10 +284,11 @@ struct b3SolveTask// : public ThreadPool::Task
float frictionCoeff = b3GetFrictionCoeff(&m_constraints[i]); float frictionCoeff = b3GetFrictionCoeff(&m_constraints[i]);
int aIdx = (int)m_constraints[i].m_bodyA; int aIdx = (int)m_constraints[i].m_bodyA;
int bIdx = (int)m_constraints[i].m_bodyB; int bIdx = (int)m_constraints[i].m_bodyB;
int localBatch = m_constraints[i].m_batchIdx; //int localBatch = m_constraints[i].m_batchIdx;
b3RigidBodyData& bodyA = m_bodies[aIdx]; b3RigidBodyData& bodyA = m_bodies[aIdx];
b3RigidBodyData& bodyB = m_bodies[bIdx]; b3RigidBodyData& bodyB = m_bodies[bIdx];
#if 0
if ((bodyA.m_invMass) && (bodyB.m_invMass)) if ((bodyA.m_invMass) && (bodyB.m_invMass))
{ {
// printf("aIdx=%d, bIdx=%d\n", aIdx,bIdx); // printf("aIdx=%d, bIdx=%d\n", aIdx,bIdx);
@@ -293,7 +297,7 @@ struct b3SolveTask// : public ThreadPool::Task
{ {
//printf("ic(b)=%d, localBatch=%d\n",ic,localBatch); //printf("ic(b)=%d, localBatch=%d\n",ic,localBatch);
} }
#endif
if (aIdx==10) if (aIdx==10)
{ {
//printf("ic(a)=%d, localBatch=%d\n",ic,localBatch); //printf("ic(a)=%d, localBatch=%d\n",ic,localBatch);
@@ -393,7 +397,7 @@ void b3CpuRigidBodyPipeline::solveContactConstraints()
int m_nIterations = 4; int m_nIterations = 4;
b3AlignedObjectArray<b3ContactConstraint4> contactConstraints; b3AlignedObjectArray<b3ContactConstraint4> contactConstraints;
const b3AlignedObjectArray<b3Contact4Data>& contacts = m_data->m_np->getContacts(); // const b3AlignedObjectArray<b3Contact4Data>& contacts = m_data->m_np->getContacts();
int n = contactConstraints.size(); int n = contactConstraints.size();
//convert contacts... //convert contacts...

View File

@@ -19,8 +19,8 @@ public:
{ {
} }
virtual void createProxy(const b3Vector3& aabbMin, const b3Vector3& aabbMax, int userPtr ,short int collisionFilterGroup,short int collisionFilterMask)=0; virtual void createProxy(const b3Vector3& aabbMin, const b3Vector3& aabbMax, int userPtr , int collisionFilterGroup, int collisionFilterMask)=0;
virtual void createLargeProxy(const b3Vector3& aabbMin, const b3Vector3& aabbMax, int userPtr ,short int collisionFilterGroup,short int collisionFilterMask)=0; virtual void createLargeProxy(const b3Vector3& aabbMin, const b3Vector3& aabbMax, int userPtr , int collisionFilterGroup, int collisionFilterMask)=0;
virtual void calculateOverlappingPairs(int maxPairs)=0; virtual void calculateOverlappingPairs(int maxPairs)=0;
virtual void calculateOverlappingPairsHost(int maxPairs)=0; virtual void calculateOverlappingPairsHost(int maxPairs)=0;

View File

@@ -38,8 +38,9 @@ m_largeAabbsMappingGPU(ctx,q),
m_gpuPairs(ctx,q), m_gpuPairs(ctx,q),
m_hashGpu(ctx,q), m_hashGpu(ctx,q),
m_paramsGPU(ctx,q),
m_cellStartGpu(ctx,q) m_cellStartGpu(ctx,q),
m_paramsGPU(ctx,q)
{ {
@@ -110,7 +111,7 @@ b3GpuGridBroadphase::~b3GpuGridBroadphase()
void b3GpuGridBroadphase::createProxy(const b3Vector3& aabbMin, const b3Vector3& aabbMax, int userPtr ,short int collisionFilterGroup,short int collisionFilterMask) void b3GpuGridBroadphase::createProxy(const b3Vector3& aabbMin, const b3Vector3& aabbMax, int userPtr , int collisionFilterGroup, int collisionFilterMask)
{ {
b3SapAabb aabb; b3SapAabb aabb;
aabb.m_minVec = aabbMin; aabb.m_minVec = aabbMin;
@@ -122,7 +123,7 @@ void b3GpuGridBroadphase::createProxy(const b3Vector3& aabbMin, const b3Vector3
m_allAabbsCPU1.push_back(aabb); m_allAabbsCPU1.push_back(aabb);
} }
void b3GpuGridBroadphase::createLargeProxy(const b3Vector3& aabbMin, const b3Vector3& aabbMax, int userPtr ,short int collisionFilterGroup,short int collisionFilterMask) void b3GpuGridBroadphase::createLargeProxy(const b3Vector3& aabbMin, const b3Vector3& aabbMax, int userPtr , int collisionFilterGroup, int collisionFilterMask)
{ {
b3SapAabb aabb; b3SapAabb aabb;
aabb.m_minVec = aabbMin; aabb.m_minVec = aabbMin;

View File

@@ -63,8 +63,8 @@ public:
virtual void createProxy(const b3Vector3& aabbMin, const b3Vector3& aabbMax, int userPtr ,short int collisionFilterGroup,short int collisionFilterMask); virtual void createProxy(const b3Vector3& aabbMin, const b3Vector3& aabbMax, int userPtr , int collisionFilterGroup, int collisionFilterMask);
virtual void createLargeProxy(const b3Vector3& aabbMin, const b3Vector3& aabbMax, int userPtr ,short int collisionFilterGroup,short int collisionFilterMask); virtual void createLargeProxy(const b3Vector3& aabbMin, const b3Vector3& aabbMax, int userPtr , int collisionFilterGroup, int collisionFilterMask);
virtual void calculateOverlappingPairs(int maxPairs); virtual void calculateOverlappingPairs(int maxPairs);
virtual void calculateOverlappingPairsHost(int maxPairs); virtual void calculateOverlappingPairsHost(int maxPairs);

View File

@@ -24,7 +24,7 @@ b3GpuParallelLinearBvhBroadphase::b3GpuParallelLinearBvhBroadphase(cl_context co
{ {
} }
void b3GpuParallelLinearBvhBroadphase::createProxy(const b3Vector3& aabbMin, const b3Vector3& aabbMax, int userPtr, short int collisionFilterGroup, short int collisionFilterMask) void b3GpuParallelLinearBvhBroadphase::createProxy(const b3Vector3& aabbMin, const b3Vector3& aabbMax, int userPtr, int collisionFilterGroup, int collisionFilterMask)
{ {
int newAabbIndex = m_aabbsCpu.size(); int newAabbIndex = m_aabbsCpu.size();
@@ -39,7 +39,7 @@ void b3GpuParallelLinearBvhBroadphase::createProxy(const b3Vector3& aabbMin, con
m_aabbsCpu.push_back(aabb); m_aabbsCpu.push_back(aabb);
} }
void b3GpuParallelLinearBvhBroadphase::createLargeProxy(const b3Vector3& aabbMin, const b3Vector3& aabbMax, int userPtr, short int collisionFilterGroup, short int collisionFilterMask) void b3GpuParallelLinearBvhBroadphase::createLargeProxy(const b3Vector3& aabbMin, const b3Vector3& aabbMax, int userPtr, int collisionFilterGroup, int collisionFilterMask)
{ {
int newAabbIndex = m_aabbsCpu.size(); int newAabbIndex = m_aabbsCpu.size();

View File

@@ -36,8 +36,8 @@ public:
b3GpuParallelLinearBvhBroadphase(cl_context context, cl_device_id device, cl_command_queue queue); b3GpuParallelLinearBvhBroadphase(cl_context context, cl_device_id device, cl_command_queue queue);
virtual ~b3GpuParallelLinearBvhBroadphase() {} virtual ~b3GpuParallelLinearBvhBroadphase() {}
virtual void createProxy(const b3Vector3& aabbMin, const b3Vector3& aabbMax, int userPtr, short int collisionFilterGroup, short int collisionFilterMask); virtual void createProxy(const b3Vector3& aabbMin, const b3Vector3& aabbMax, int userPtr, int collisionFilterGroup, int collisionFilterMask);
virtual void createLargeProxy(const b3Vector3& aabbMin, const b3Vector3& aabbMax, int userPtr, short int collisionFilterGroup, short int collisionFilterMask); virtual void createLargeProxy(const b3Vector3& aabbMin, const b3Vector3& aabbMax, int userPtr, int collisionFilterGroup, int collisionFilterMask);
virtual void calculateOverlappingPairs(int maxPairs); virtual void calculateOverlappingPairs(int maxPairs);
virtual void calculateOverlappingPairsHost(int maxPairs); virtual void calculateOverlappingPairsHost(int maxPairs);

View File

@@ -14,22 +14,53 @@ bool searchIncremental3dSapOnGpu = true;
#define B3_BROADPHASE_SAP_PATH "src/Bullet3OpenCL/BroadphaseCollision/kernels/sap.cl" #define B3_BROADPHASE_SAP_PATH "src/Bullet3OpenCL/BroadphaseCollision/kernels/sap.cl"
/*
b3OpenCLArray<int> m_pairCount;
b3OpenCLArray<b3SapAabb> m_allAabbsGPU;
b3AlignedObjectArray<b3SapAabb> m_allAabbsCPU;
virtual b3OpenCLArray<b3SapAabb>& getAllAabbsGPU()
{
return m_allAabbsGPU;
}
virtual b3AlignedObjectArray<b3SapAabb>& getAllAabbsCPU()
{
return m_allAabbsCPU;
}
b3OpenCLArray<b3Vector3> m_sum;
b3OpenCLArray<b3Vector3> m_sum2;
b3OpenCLArray<b3Vector3> m_dst;
b3OpenCLArray<int> m_smallAabbsMappingGPU;
b3AlignedObjectArray<int> m_smallAabbsMappingCPU;
b3OpenCLArray<int> m_largeAabbsMappingGPU;
b3AlignedObjectArray<int> m_largeAabbsMappingCPU;
b3OpenCLArray<b3Int4> m_overlappingPairs;
//temporary gpu work memory
b3OpenCLArray<b3SortData> m_gpuSmallSortData;
b3OpenCLArray<b3SapAabb> m_gpuSmallSortedAabbs;
class b3PrefixScanFloat4CL* m_prefixScanFloat4;
*/
b3GpuSapBroadphase::b3GpuSapBroadphase(cl_context ctx,cl_device_id device, cl_command_queue q , b3GpuSapKernelType kernelType) b3GpuSapBroadphase::b3GpuSapBroadphase(cl_context ctx,cl_device_id device, cl_command_queue q , b3GpuSapKernelType kernelType)
:m_context(ctx), :m_context(ctx),
m_device(device), m_device(device),
m_queue(q), m_queue(q),
m_allAabbsGPU(ctx,q),
m_smallAabbsMappingGPU(ctx,q),
m_largeAabbsMappingGPU(ctx,q),
m_pairCount(ctx,q),
m_overlappingPairs(ctx,q),
m_gpuSmallSortData(ctx,q),
m_gpuSmallSortedAabbs(ctx,q),
m_sum(ctx,q),
m_sum2(ctx,q),
m_dst(ctx,q),
m_currentBuffer(-1),
m_objectMinMaxIndexGPUaxis0(ctx,q), m_objectMinMaxIndexGPUaxis0(ctx,q),
m_objectMinMaxIndexGPUaxis1(ctx,q), m_objectMinMaxIndexGPUaxis1(ctx,q),
m_objectMinMaxIndexGPUaxis2(ctx,q), m_objectMinMaxIndexGPUaxis2(ctx,q),
@@ -45,7 +76,18 @@ m_sortedAxisGPU2prev(ctx,q),
m_addedHostPairsGPU(ctx,q), m_addedHostPairsGPU(ctx,q),
m_removedHostPairsGPU(ctx,q), m_removedHostPairsGPU(ctx,q),
m_addedCountGPU(ctx,q), m_addedCountGPU(ctx,q),
m_removedCountGPU(ctx,q) m_removedCountGPU(ctx,q),
m_currentBuffer(-1),
m_pairCount(ctx,q),
m_allAabbsGPU(ctx,q),
m_sum(ctx,q),
m_sum2(ctx,q),
m_dst(ctx,q),
m_smallAabbsMappingGPU(ctx,q),
m_largeAabbsMappingGPU(ctx,q),
m_overlappingPairs(ctx,q),
m_gpuSmallSortData(ctx,q),
m_gpuSmallSortedAabbs(ctx,q)
{ {
const char* sapSrc = sapCL; const char* sapSrc = sapCL;
@@ -191,7 +233,7 @@ void b3GpuSapBroadphase::init3dSap()
for (int axis=0;axis<3;axis++) for (int axis=0;axis<3;axis++)
{ {
int totalNumAabbs = m_allAabbsCPU.size(); //int totalNumAabbs = m_allAabbsCPU.size();
int numEndPoints = m_sortedAxisCPU[axis][m_currentBuffer].size(); int numEndPoints = m_sortedAxisCPU[axis][m_currentBuffer].size();
m_objectMinMaxIndexCPU[axis][m_currentBuffer].resize(numEndPoints); m_objectMinMaxIndexCPU[axis][m_currentBuffer].resize(numEndPoints);
for (int i=0;i<numEndPoints;i++) for (int i=0;i<numEndPoints;i++)
@@ -240,7 +282,7 @@ b3AlignedObjectArray<b3SapAabb> preAabbs;
void b3GpuSapBroadphase::calculateOverlappingPairsHostIncremental3Sap() void b3GpuSapBroadphase::calculateOverlappingPairsHostIncremental3Sap()
{ {
static int framepje = 0; //static int framepje = 0;
//printf("framepje=%d\n",framepje++); //printf("framepje=%d\n",framepje++);
@@ -371,6 +413,7 @@ void b3GpuSapBroadphase::calculateOverlappingPairsHostIncremental3Sap()
m_sorter->executeHost(m_sortedAxisCPU[axis][m_currentBuffer]); m_sorter->executeHost(m_sortedAxisCPU[axis][m_currentBuffer]);
} }
#if 0
if (0) if (0)
{ {
for (int axis=0;axis<3;axis++) for (int axis=0;axis<3;axis++)
@@ -378,14 +421,14 @@ void b3GpuSapBroadphase::calculateOverlappingPairsHostIncremental3Sap()
//printf("axis %d\n",axis); //printf("axis %d\n",axis);
for (int i=0;i<m_sortedAxisCPU[axis][m_currentBuffer].size();i++) for (int i=0;i<m_sortedAxisCPU[axis][m_currentBuffer].size();i++)
{ {
int key = m_sortedAxisCPU[axis][m_currentBuffer][i].m_key; //int key = m_sortedAxisCPU[axis][m_currentBuffer][i].m_key;
int value = m_sortedAxisCPU[axis][m_currentBuffer][i].m_value; //int value = m_sortedAxisCPU[axis][m_currentBuffer][i].m_value;
//printf("[%d]=%d\n",i,value); //printf("[%d]=%d\n",i,value);
} }
} }
} }
#endif
{ {
B3_PROFILE("assign m_objectMinMaxIndexCPU"); B3_PROFILE("assign m_objectMinMaxIndexCPU");
@@ -409,7 +452,7 @@ void b3GpuSapBroadphase::calculateOverlappingPairsHostIncremental3Sap()
} }
} }
#if 0
if (0) if (0)
{ {
printf("==========================\n"); printf("==========================\n");
@@ -440,6 +483,7 @@ void b3GpuSapBroadphase::calculateOverlappingPairsHostIncremental3Sap()
} }
} }
#endif
int a = m_objectMinMaxIndexCPU[0][m_currentBuffer].size(); int a = m_objectMinMaxIndexCPU[0][m_currentBuffer].size();
@@ -654,7 +698,7 @@ void b3GpuSapBroadphase::calculateOverlappingPairsHostIncremental3Sap()
int otherIndex = otherIndex2/2; int otherIndex = otherIndex2/2;
if (otherIndex!=i) if (otherIndex!=i)
{ {
bool otherIsMin = ((otherIndex2&1)==0); //bool otherIsMin = ((otherIndex2&1)==0);
//if (otherIsMin) //if (otherIsMin)
{ {
//bool overlap = TestAabbAgainstAabb2((const b3Vector3&)m_allAabbsCPU[i].m_min, (const b3Vector3&)m_allAabbsCPU[i].m_max,(const b3Vector3&)m_allAabbsCPU[otherIndex].m_min,(const b3Vector3&)m_allAabbsCPU[otherIndex].m_max); //bool overlap = TestAabbAgainstAabb2((const b3Vector3&)m_allAabbsCPU[i].m_min, (const b3Vector3&)m_allAabbsCPU[i].m_max,(const b3Vector3&)m_allAabbsCPU[otherIndex].m_min,(const b3Vector3&)m_allAabbsCPU[otherIndex].m_max);
@@ -906,7 +950,7 @@ void b3GpuSapBroadphase::calculateOverlappingPairsHost(int maxPairs)
for (int i=0;i<numSmallAabbs;i++) for (int i=0;i<numSmallAabbs;i++)
{ {
b3SapAabb smallAabbi = m_allAabbsCPU[m_smallAabbsMappingCPU[i]]; b3SapAabb smallAabbi = m_allAabbsCPU[m_smallAabbsMappingCPU[i]];
float reference = smallAabbi.m_max[axis]; //float reference = smallAabbi.m_max[axis];
for (int j=i+1;j<numSmallAabbs;j++) for (int j=i+1;j<numSmallAabbs;j++)
{ {
@@ -941,7 +985,7 @@ void b3GpuSapBroadphase::calculateOverlappingPairsHost(int maxPairs)
{ {
b3SapAabb smallAabbi = m_allAabbsCPU[m_smallAabbsMappingCPU[i]]; b3SapAabb smallAabbi = m_allAabbsCPU[m_smallAabbsMappingCPU[i]];
float reference = smallAabbi.m_max[axis]; //float reference = smallAabbi.m_max[axis];
int numLargeAabbs = m_largeAabbsMappingCPU.size(); int numLargeAabbs = m_largeAabbsMappingCPU.size();
for (int j=0;j<numLargeAabbs;j++) for (int j=0;j<numLargeAabbs;j++)
@@ -1022,7 +1066,7 @@ void b3GpuSapBroadphase::calculateOverlappingPairs(int maxPairs)
{ {
bool syncOnHost = false; //bool syncOnHost = false;
int numSmallAabbs = m_smallAabbsMappingCPU.size(); int numSmallAabbs = m_smallAabbsMappingCPU.size();
if (m_prefixScanFloat4 && numSmallAabbs) if (m_prefixScanFloat4 && numSmallAabbs)
@@ -1261,7 +1305,7 @@ void b3GpuSapBroadphase::writeAabbsToGpu()
} }
void b3GpuSapBroadphase::createLargeProxy(const b3Vector3& aabbMin, const b3Vector3& aabbMax, int userPtr ,short int collisionFilterGroup,short int collisionFilterMask) void b3GpuSapBroadphase::createLargeProxy(const b3Vector3& aabbMin, const b3Vector3& aabbMax, int userPtr , int collisionFilterGroup, int collisionFilterMask)
{ {
int index = userPtr; int index = userPtr;
b3SapAabb aabb; b3SapAabb aabb;
@@ -1277,7 +1321,7 @@ void b3GpuSapBroadphase::createLargeProxy(const b3Vector3& aabbMin, const b3Vec
m_allAabbsCPU.push_back(aabb); m_allAabbsCPU.push_back(aabb);
} }
void b3GpuSapBroadphase::createProxy(const b3Vector3& aabbMin, const b3Vector3& aabbMax, int userPtr ,short int collisionFilterGroup,short int collisionFilterMask) void b3GpuSapBroadphase::createProxy(const b3Vector3& aabbMin, const b3Vector3& aabbMax, int userPtr , int collisionFilterGroup, int collisionFilterMask)
{ {
int index = userPtr; int index = userPtr;
b3SapAabb aabb; b3SapAabb aabb;

View File

@@ -133,8 +133,8 @@ public:
void init3dSap(); void init3dSap();
virtual void calculateOverlappingPairsHostIncremental3Sap(); virtual void calculateOverlappingPairsHostIncremental3Sap();
virtual void createProxy(const b3Vector3& aabbMin, const b3Vector3& aabbMax, int userPtr ,short int collisionFilterGroup,short int collisionFilterMask); virtual void createProxy(const b3Vector3& aabbMin, const b3Vector3& aabbMax, int userPtr , int collisionFilterGroup, int collisionFilterMask);
virtual void createLargeProxy(const b3Vector3& aabbMin, const b3Vector3& aabbMax, int userPtr ,short int collisionFilterGroup,short int collisionFilterMask); virtual void createLargeProxy(const b3Vector3& aabbMin, const b3Vector3& aabbMax, int userPtr , int collisionFilterGroup, int collisionFilterMask);
//call writeAabbsToGpu after done making all changes (createProxy etc) //call writeAabbsToGpu after done making all changes (createProxy etc)
virtual void writeAabbsToGpu(); virtual void writeAabbsToGpu();

View File

@@ -172,7 +172,7 @@ cl_platform_id b3OpenCLUtils_getPlatform(int platformIndex0, cl_int* pErrNum)
cl_uint numPlatforms; cl_uint numPlatforms;
cl_int ciErrNum = clGetPlatformIDs(0, NULL, &numPlatforms); cl_int ciErrNum = clGetPlatformIDs(0, NULL, &numPlatforms);
if (platformIndex>=0 && platformIndex<numPlatforms) if (platformIndex<numPlatforms)
{ {
cl_platform_id* platforms = (cl_platform_id*) malloc (sizeof(cl_platform_id)*numPlatforms); cl_platform_id* platforms = (cl_platform_id*) malloc (sizeof(cl_platform_id)*numPlatforms);
ciErrNum = clGetPlatformIDs(numPlatforms, platforms, NULL); ciErrNum = clGetPlatformIDs(numPlatforms, platforms, NULL);
@@ -583,7 +583,7 @@ static const char* strip2(const char* name, const char* pattern)
const char * oriptr; const char * oriptr;
const char * patloc; const char * patloc;
// find how many times the pattern occurs in the original string // find how many times the pattern occurs in the original string
for (oriptr = name; patloc = strstr(oriptr, pattern); oriptr = patloc + patlen) for (oriptr = name; (patloc = strstr(oriptr, pattern)); oriptr = patloc + patlen)
{ {
patcnt++; patcnt++;
} }
@@ -608,8 +608,9 @@ cl_program b3OpenCLUtils_compileCLProgramFromString(cl_context clContext, cl_dev
char driverVersion[256]; char driverVersion[256];
const char* strippedName; const char* strippedName;
int fileUpToDate = 0; int fileUpToDate = 0;
#ifdef _WIN32
int binaryFileValid=0; int binaryFileValid=0;
#endif
if (!disableBinaryCaching && clFileNameForCaching) if (!disableBinaryCaching && clFileNameForCaching)
{ {
clGetDeviceInfo(device, CL_DEVICE_NAME, 256, &deviceName, NULL); clGetDeviceInfo(device, CL_DEVICE_NAME, 256, &deviceName, NULL);
@@ -862,7 +863,8 @@ cl_program b3OpenCLUtils_compileCLProgramFromString(cl_context clContext, cl_dev
int kernelSize = ftell( file ); int kernelSize = ftell( file );
rewind( file ); rewind( file );
kernelSrc = (char*)malloc(kernelSize+1); kernelSrc = (char*)malloc(kernelSize+1);
int readBytes = fread((void*)kernelSrc,1,kernelSize, file); int readBytes;
readBytes = fread((void*)kernelSrc,1,kernelSize, file);
kernelSrc[kernelSize] = 0; kernelSrc[kernelSize] = 0;
fclose(file); fclose(file);
kernelSource = kernelSrc; kernelSource = kernelSrc;

View File

@@ -105,21 +105,29 @@ GpuSatCollision::GpuSatCollision(cl_context ctx,cl_device_id device, cl_command_
:m_context(ctx), :m_context(ctx),
m_device(device), m_device(device),
m_queue(q), m_queue(q),
m_findSeparatingAxisKernel(0), m_findSeparatingAxisKernel(0),
m_findSeparatingAxisVertexFaceKernel(0), m_findSeparatingAxisVertexFaceKernel(0),
m_findSeparatingAxisEdgeEdgeKernel(0), m_findSeparatingAxisEdgeEdgeKernel(0),
m_unitSphereDirections(m_context,m_queue),
m_totalContactsOut(m_context, m_queue), m_totalContactsOut(m_context, m_queue),
m_sepNormals(m_context, m_queue), m_sepNormals(m_context, m_queue),
m_dmins(m_context,m_queue),
m_hasSeparatingNormals(m_context, m_queue), m_hasSeparatingNormals(m_context, m_queue),
m_concaveSepNormals(m_context, m_queue), m_concaveSepNormals(m_context, m_queue),
m_concaveHasSeparatingNormals(m_context,m_queue), m_concaveHasSeparatingNormals(m_context,m_queue),
m_numConcavePairsOut(m_context, m_queue), m_numConcavePairsOut(m_context, m_queue),
m_gpuCompoundPairs(m_context, m_queue), m_gpuCompoundPairs(m_context, m_queue),
m_gpuCompoundSepNormals(m_context, m_queue), m_gpuCompoundSepNormals(m_context, m_queue),
m_gpuHasCompoundSepNormals(m_context, m_queue), m_gpuHasCompoundSepNormals(m_context, m_queue),
m_numCompoundPairsOut(m_context, m_queue),
m_dmins(m_context,m_queue), m_numCompoundPairsOut(m_context, m_queue)
m_unitSphereDirections(m_context,m_queue)
{ {
m_totalContactsOut.push_back(0); m_totalContactsOut.push_back(0);
@@ -553,7 +561,7 @@ inline void project(const b3ConvexPolyhedronData& hull, const float4& pos, cons
{ {
//b3Vector3 pt = trans * vertices[m_vertexOffset+i]; //b3Vector3 pt = trans * vertices[m_vertexOffset+i];
//b3Scalar dp = pt.dot(dir); //b3Scalar dp = pt.dot(dir);
b3Vector3 vertex = vertices[hull.m_vertexOffset+i]; //b3Vector3 vertex = vertices[hull.m_vertexOffset+i];
b3Scalar dp = dot3F4((float4&)vertices[hull.m_vertexOffset+i],localDir); b3Scalar dp = dot3F4((float4&)vertices[hull.m_vertexOffset+i],localDir);
//b3Assert(dp==dpL); //b3Assert(dp==dpL);
if(dp < min) min = dp; if(dp < min) min = dp;
@@ -764,7 +772,7 @@ bool findSeparatingAxisEdgeEdge( __global const b3ConvexPolyhedronData* hullA, _
float4 posB = posB1; float4 posB = posB1;
posB.w = 0.f; posB.w = 0.f;
int curPlaneTests=0; //int curPlaneTests=0;
int curEdgeEdge = 0; int curEdgeEdge = 0;
// Test edges // Test edges
@@ -927,7 +935,7 @@ int clipFaceAgainstHull(const float4& separatingNormal, const b3ConvexPolyhedron
b3GpuFace polyA = facesA[hullA->m_faceOffset+closestFaceA]; b3GpuFace polyA = facesA[hullA->m_faceOffset+closestFaceA];
// clip polygon to back of planes of all faces of hull A that are adjacent to witness face // clip polygon to back of planes of all faces of hull A that are adjacent to witness face
int numContacts = numWorldVertsB1; // int numContacts = numWorldVertsB1;
int numVerticesA = polyA.m_numIndices; int numVerticesA = polyA.m_numIndices;
for(int e0=0;e0<numVerticesA;e0++) for(int e0=0;e0<numVerticesA;e0++)
{ {
@@ -1008,7 +1016,7 @@ static int clipHullAgainstHull(const float4& separatingNormal,
B3_PROFILE("clipHullAgainstHull"); B3_PROFILE("clipHullAgainstHull");
float curMaxDist=maxDist; // float curMaxDist=maxDist;
int closestFaceB=-1; int closestFaceB=-1;
float dmax = -FLT_MAX; float dmax = -FLT_MAX;
@@ -1318,7 +1326,7 @@ int clipHullHullSingle(
contact.m_frictionCoeffCmp = 45874; contact.m_frictionCoeffCmp = 45874;
contact.m_restituitionCoeffCmp = 0; contact.m_restituitionCoeffCmp = 0;
float distance = 0.f; // float distance = 0.f;
for (int p=0;p<numPoints;p++) for (int p=0;p<numPoints;p++)
{ {
contact.m_worldPosB[p] = contactsOut[contactIdx.s[p]];//check if it is actually on B contact.m_worldPosB[p] = contactsOut[contactIdx.s[p]];//check if it is actually on B
@@ -1362,8 +1370,8 @@ void computeContactPlaneConvex(int pairIndex,
b3Vector3 posA = rigidBodies[bodyIndexA].m_pos; b3Vector3 posA = rigidBodies[bodyIndexA].m_pos;
b3Quaternion ornA = rigidBodies[bodyIndexA].m_quat; b3Quaternion ornA = rigidBodies[bodyIndexA].m_quat;
int numContactsOut = 0; // int numContactsOut = 0;
int numWorldVertsB1= 0; // int numWorldVertsB1= 0;
b3Vector3 planeEq = faces[collidables[collidableIndexA].m_shapeIndex].m_plane; b3Vector3 planeEq = faces[collidables[collidableIndexA].m_shapeIndex].m_plane;
b3Vector3 planeNormal=b3MakeVector3(planeEq.x,planeEq.y,planeEq.z); b3Vector3 planeNormal=b3MakeVector3(planeEq.x,planeEq.y,planeEq.z);
@@ -1518,7 +1526,7 @@ __kernel void findCompoundPairsKernel(
{ {
numAabbChecks=0; numAabbChecks=0;
maxNumAabbChecks=0; maxNumAabbChecks=0;
int i = pairIndex; // int i = pairIndex;
{ {
@@ -1590,10 +1598,10 @@ __kernel void findCompoundPairsKernel(
{ {
int startNodeIndexA = subtreeA.m_rootNodeIndex+bvhInfoCPU[bvhA].m_nodeOffset; int startNodeIndexA = subtreeA.m_rootNodeIndex+bvhInfoCPU[bvhA].m_nodeOffset;
int endNodeIndexA = startNodeIndexA+subtreeA.m_subtreeSize; // int endNodeIndexA = startNodeIndexA+subtreeA.m_subtreeSize;
int startNodeIndexB = subtreeB.m_rootNodeIndex+bvhInfoCPU[bvhB].m_nodeOffset; int startNodeIndexB = subtreeB.m_rootNodeIndex+bvhInfoCPU[bvhB].m_nodeOffset;
int endNodeIndexB = startNodeIndexB+subtreeB.m_subtreeSize; // int endNodeIndexB = startNodeIndexB+subtreeB.m_subtreeSize;
b3AlignedObjectArray<b3Int2> nodeStack; b3AlignedObjectArray<b3Int2> nodeStack;
b3Int2 node0; b3Int2 node0;
@@ -1790,19 +1798,21 @@ __kernel void findCompoundPairsKernel(
{ {
if (1) if (1)
{ {
int numFacesA = convexShapes[shapeIndexA].m_numFaces; // int numFacesA = convexShapes[shapeIndexA].m_numFaces;
float dmin = FLT_MAX; // float dmin = FLT_MAX;
float4 posA = newPosA; float4 posA = newPosA;
posA.w = 0.f; posA.w = 0.f;
float4 posB = rigidBodies[bodyIndexB].m_pos; float4 posB = rigidBodies[bodyIndexB].m_pos;
posB.w = 0.f; posB.w = 0.f;
float4 c0local = convexShapes[shapeIndexA].m_localCenter; float4 c0local = convexShapes[shapeIndexA].m_localCenter;
b3Quat ornA = newOrnA; b3Quat ornA = newOrnA;
float4 c0 = transform(&c0local, &posA, &ornA); float4 c0;
c0 = transform(&c0local, &posA, &ornA);
float4 c1local = convexShapes[shapeIndexB].m_localCenter; float4 c1local = convexShapes[shapeIndexB].m_localCenter;
b3Quat ornB = rigidBodies[bodyIndexB].m_quat; b3Quat ornB = rigidBodies[bodyIndexB].m_quat;
float4 c1 = transform(&c1local,&posB,&ornB); float4 c1;
const float4 DeltaC2 = c0 - c1; c1 = transform(&c1local,&posB,&ornB);
// const float4 DeltaC2 = c0 - c1;
{ {
int compoundPairIdx = b3AtomicInc(numCompoundPairsOut); int compoundPairIdx = b3AtomicInc(numCompoundPairsOut);
@@ -1838,19 +1848,21 @@ __kernel void findCompoundPairsKernel(
if (1) if (1)
{ {
int numFacesA = convexShapes[shapeIndexA].m_numFaces; // int numFacesA = convexShapes[shapeIndexA].m_numFaces;
float dmin = FLT_MAX; // float dmin = FLT_MAX;
float4 posA = rigidBodies[bodyIndexA].m_pos; float4 posA = rigidBodies[bodyIndexA].m_pos;
posA.w = 0.f; posA.w = 0.f;
float4 posB = newPosB; float4 posB = newPosB;
posB.w = 0.f; posB.w = 0.f;
float4 c0local = convexShapes[shapeIndexA].m_localCenter; float4 c0local = convexShapes[shapeIndexA].m_localCenter;
b3Quat ornA = rigidBodies[bodyIndexA].m_quat; b3Quat ornA = rigidBodies[bodyIndexA].m_quat;
float4 c0 = transform(&c0local, &posA, &ornA); float4 c0;
c0 = transform(&c0local, &posA, &ornA);
float4 c1local = convexShapes[shapeIndexB].m_localCenter; float4 c1local = convexShapes[shapeIndexB].m_localCenter;
b3Quat ornB =newOrnB; b3Quat ornB =newOrnB;
float4 c1 = transform(&c1local,&posB,&ornB); float4 c1;
const float4 DeltaC2 = c0 - c1; c1 = transform(&c1local,&posB,&ornB);
// const float4 DeltaC2 = c0 - c1;
{// {//
int compoundPairIdx = b3AtomicInc(numCompoundPairsOut); int compoundPairIdx = b3AtomicInc(numCompoundPairsOut);
if (compoundPairIdx<maxNumCompoundPairsCapacity) if (compoundPairIdx<maxNumCompoundPairsCapacity)
@@ -1948,7 +1960,7 @@ __kernel void processCompoundPairsKernel( __global const b3Int4* gpuCompoundPa
int hasSeparatingAxis = 5; int hasSeparatingAxis = 5;
int numFacesA = convexShapes[shapeIndexA].m_numFaces; // int numFacesA = convexShapes[shapeIndexA].m_numFaces;
float dmin = FLT_MAX; float dmin = FLT_MAX;
posA.w = 0.f; posA.w = 0.f;
posB.w = 0.f; posB.w = 0.f;
@@ -2326,8 +2338,8 @@ void computeContactPlaneCompound(int pairIndex,
b3Vector3 posA = rigidBodies[bodyIndexA].m_pos; b3Vector3 posA = rigidBodies[bodyIndexA].m_pos;
b3Quaternion ornA = rigidBodies[bodyIndexA].m_quat; b3Quaternion ornA = rigidBodies[bodyIndexA].m_quat;
int numContactsOut = 0; // int numContactsOut = 0;
int numWorldVertsB1= 0; // int numWorldVertsB1= 0;
b3Vector3 planeEq = faces[collidables[collidableIndexA].m_shapeIndex].m_plane; b3Vector3 planeEq = faces[collidables[collidableIndexA].m_shapeIndex].m_plane;
b3Vector3 planeNormal=b3MakeVector3(planeEq.x,planeEq.y,planeEq.z); b3Vector3 planeNormal=b3MakeVector3(planeEq.x,planeEq.y,planeEq.z);
@@ -2475,7 +2487,7 @@ void computeContactSphereConvex(int pairIndex,
int shapeIndex = collidables[collidableIndex].m_shapeIndex; int shapeIndex = collidables[collidableIndex].m_shapeIndex;
int numFaces = convexShapes[shapeIndex].m_numFaces; int numFaces = convexShapes[shapeIndex].m_numFaces;
float4 closestPnt = b3MakeVector3(0, 0, 0, 0); float4 closestPnt = b3MakeVector3(0, 0, 0, 0);
float4 hitNormalWorld = b3MakeVector3(0, 0, 0, 0); // float4 hitNormalWorld = b3MakeVector3(0, 0, 0, 0);
float minDist = -1000000.f; // TODO: What is the largest/smallest float? float minDist = -1000000.f; // TODO: What is the largest/smallest float?
bool bCollide = true; bool bCollide = true;
int region = -1; int region = -1;
@@ -2641,7 +2653,7 @@ int computeContactConvexConvex( b3AlignedObjectArray<b3Int4>& pairs,
int shapeIndexA = collidables[collidableIndexA].m_shapeIndex; int shapeIndexA = collidables[collidableIndexA].m_shapeIndex;
int shapeIndexB = collidables[collidableIndexB].m_shapeIndex; int shapeIndexB = collidables[collidableIndexB].m_shapeIndex;
int sz = sizeof(b3Contact4); //int sz = sizeof(b3Contact4);
bool result2 = getClosestPoints(&gjkDetector, transA, transB, bool result2 = getClosestPoints(&gjkDetector, transA, transB,
convexShapes[shapeIndexA], convexShapes[shapeIndexB], convexShapes[shapeIndexA], convexShapes[shapeIndexB],
@@ -2709,8 +2721,8 @@ int computeContactConvexConvex( b3AlignedObjectArray<b3Int4>& pairs,
{ {
resultPointOnBWorld.w = distance2; resultPointOnBWorld.w = distance2;
newContact.m_worldPosB[p] = resultPointOnBWorld; newContact.m_worldPosB[p] = resultPointOnBWorld;
b3Vector3 resultPointOnAWorld = resultPointOnBWorld+distance2*sepAxis2;
#ifdef PERSISTENT_CONTACTS_HOST #ifdef PERSISTENT_CONTACTS_HOST
b3Vector3 resultPointOnAWorld = resultPointOnBWorld+distance2*sepAxis2;
newContact.m_localPosA[p] = transA.inverse()*resultPointOnAWorld; newContact.m_localPosA[p] = transA.inverse()*resultPointOnAWorld;
newContact.m_localPosB[p] = transB.inverse()*resultPointOnBWorld; newContact.m_localPosB[p] = transB.inverse()*resultPointOnBWorld;
#endif #endif
@@ -2774,8 +2786,8 @@ int computeContactConvexConvex2(
hullB = convexShapes[colB.m_shapeIndex]; hullB = convexShapes[colB.m_shapeIndex];
//printf("numvertsB = %d\n",hullB.m_numVertices); //printf("numvertsB = %d\n",hullB.m_numVertices);
int contactCapacity = MAX_VERTS; // int contactCapacity = MAX_VERTS;
int numContactsOut=0; //int numContactsOut=0;
#ifdef _WIN32 #ifdef _WIN32
@@ -3488,7 +3500,7 @@ void GpuSatCollision::computeConvexConvexContactsGPUSAT( b3OpenCLArray<b3Int4>*
//add contact point //add contact point
int contactIndex = nGlobalContactsOut; //int contactIndex = nGlobalContactsOut;
b3Contact4& newContact = hostContacts.at(nGlobalContactsOut); b3Contact4& newContact = hostContacts.at(nGlobalContactsOut);
nGlobalContactsOut++; nGlobalContactsOut++;
newContact.m_batchIdx = 0;//i; newContact.m_batchIdx = 0;//i;
@@ -3511,7 +3523,7 @@ void GpuSatCollision::computeConvexConvexContactsGPUSAT( b3OpenCLArray<b3Int4>*
resultPointOnBWorld.w = -depth; resultPointOnBWorld.w = -depth;
newContact.m_worldPosB[0] = resultPointOnBWorld; newContact.m_worldPosB[0] = resultPointOnBWorld;
b3Vector3 resultPointOnAWorld = resultPointOnBWorld+depth*sepAxis2; //b3Vector3 resultPointOnAWorld = resultPointOnBWorld+depth*sepAxis2;
newContact.m_worldNormalOnB = sepAxis2; newContact.m_worldNormalOnB = sepAxis2;
newContact.m_worldNormalOnB.w = (b3Scalar)1; newContact.m_worldNormalOnB.w = (b3Scalar)1;
} else } else
@@ -3527,7 +3539,8 @@ void GpuSatCollision::computeConvexConvexContactsGPUSAT( b3OpenCLArray<b3Int4>*
int result = computeContactConvexConvex( hostPairs, int result;
result = computeContactConvexConvex( hostPairs,
pairIndex, pairIndex,
bodyIndexA, bodyIndexB, bodyIndexA, bodyIndexB,
collidableIndexA, collidableIndexB, collidableIndexA, collidableIndexB,
@@ -3893,7 +3906,7 @@ void GpuSatCollision::computeConvexConvexContactsGPUSAT( b3OpenCLArray<b3Int4>*
b3AlignedObjectArray<b3Int4> triangleConvexPairsOutHost; b3AlignedObjectArray<b3Int4> triangleConvexPairsOutHost;
triangleConvexPairsOutHost.resize(maxTriConvexPairCapacity); triangleConvexPairsOutHost.resize(maxTriConvexPairCapacity);
int numTriConvexPairsOutHost=0; //int numTriConvexPairsOutHost=0;
numConcavePairs = 0; numConcavePairs = 0;
//m_numConcavePairsOut //m_numConcavePairsOut

View File

@@ -97,7 +97,7 @@ inline void project(const b3ConvexPolyhedronData& hull, const float4& pos, cons
{ {
//b3Vector3 pt = trans * vertices[m_vertexOffset+i]; //b3Vector3 pt = trans * vertices[m_vertexOffset+i];
//b3Scalar dp = pt.dot(dir); //b3Scalar dp = pt.dot(dir);
b3Vector3 vertex = vertices[hull.m_vertexOffset+i]; //b3Vector3 vertex = vertices[hull.m_vertexOffset+i];
b3Scalar dp = dot3F4((float4&)vertices[hull.m_vertexOffset+i],localDir); b3Scalar dp = dot3F4((float4&)vertices[hull.m_vertexOffset+i],localDir);
//b3Assert(dp==dpL); //b3Assert(dp==dpL);
if(dp < min) min = dp; if(dp < min) min = dp;
@@ -113,7 +113,7 @@ inline void project(const b3ConvexPolyhedronData& hull, const float4& pos, cons
max += offset; max += offset;
} }
#if 0
static bool TestSepAxis(const b3ConvexPolyhedronData& hullA, const b3ConvexPolyhedronData& hullB, static bool TestSepAxis(const b3ConvexPolyhedronData& hullA, const b3ConvexPolyhedronData& hullB,
const float4& posA,const b3Quaternion& ornA, const float4& posA,const b3Quaternion& ornA,
const float4& posB,const b3Quaternion& ornB, const float4& posB,const b3Quaternion& ornB,
@@ -143,7 +143,7 @@ static bool TestSepAxis(const b3ConvexPolyhedronData& hullA, const b3ConvexPolyh
return true; return true;
} }
#endif
bool getClosestPoints(b3GjkPairDetector* gjkDetector, const b3Transform& transA, const b3Transform& transB, bool getClosestPoints(b3GjkPairDetector* gjkDetector, const b3Transform& transA, const b3Transform& transB,
const b3ConvexPolyhedronData& hullA, const b3ConvexPolyhedronData& hullB, const b3ConvexPolyhedronData& hullA, const b3ConvexPolyhedronData& hullB,
@@ -198,11 +198,11 @@ bool getClosestPoints(b3GjkPairDetector* gjkDetector, const b3Transform& transA,
{ {
b3Scalar squaredDistance = B3_LARGE_FLOAT; b3Scalar squaredDistance = B3_LARGE_FLOAT;
b3Scalar delta = -1e30f;//b3Scalar(0.); b3Scalar delta = -1e30f;//b3Scalar(0.);
b3Scalar prevDelta = -1e30f;//b3Scalar(0.); // b3Scalar prevDelta = -1e30f;//b3Scalar(0.);
b3Scalar margin = marginA + marginB; b3Scalar margin = marginA + marginB;
b3Scalar bestDeltaN = -1e30f; // b3Scalar bestDeltaN = -1e30f;
b3Vector3 bestSepAxis= b3MakeVector3(0,0,0); // b3Vector3 bestSepAxis= b3MakeVector3(0,0,0);

View File

@@ -157,7 +157,7 @@ typedef b3AlignedObjectArray<b3BvhSubtreeInfo> BvhSubtreeInfoArray;
///The b3QuantizedBvh class stores an AABB tree that can be quickly traversed on CPU and Cell SPU. ///The b3QuantizedBvh class stores an AABB tree that can be quickly traversed on CPU and Cell SPU.
///It is used by the b3BvhTriangleMeshShape as midphase, and by the b3MultiSapBroadphase. ///It is used by the b3BvhTriangleMeshShape as midphase
///It is recommended to use quantization for better performance and lower memory requirements. ///It is recommended to use quantization for better performance and lower memory requirements.
B3_ATTRIBUTE_ALIGNED16(class) b3QuantizedBvh B3_ATTRIBUTE_ALIGNED16(class) b3QuantizedBvh
{ {

Some files were not shown because too many files have changed in this diff Show More