cmake Win32 fixes

fixed some more warnings
added alignment macros to some classes
btPersistentManifold from 128 to 16 bytes aligned
prepare command to select collision filter mode (SIM_PARAM_UPDATE_COLLISION_FILTER_MODE)
This commit is contained in:
Erwin Coumans
2017-01-16 13:05:26 -08:00
parent 3dfcd27147
commit 93471a1c31
14 changed files with 50 additions and 28 deletions

View File

@@ -994,11 +994,11 @@ void btWorldImporter::convertConstraintFloat(btTypedConstraintFloatData* constra
dof->setStiffness(i,dofData->m_linearSpringStiffness.m_floats[i],dofData->m_linearSpringStiffnessLimited[i]!=0); dof->setStiffness(i,dofData->m_linearSpringStiffness.m_floats[i],dofData->m_linearSpringStiffnessLimited[i]!=0);
dof->setEquilibriumPoint(i,dofData->m_linearEquilibriumPoint.m_floats[i]); dof->setEquilibriumPoint(i,dofData->m_linearEquilibriumPoint.m_floats[i]);
dof->enableSpring(i,dofData->m_linearEnableSpring[i]!=0); dof->enableSpring(i,dofData->m_linearEnableSpring[i]!=0);
dof->setDamping(i,dofData->m_linearSpringDamping.m_floats[i],dofData->m_linearSpringDampingLimited[i]); dof->setDamping(i,dofData->m_linearSpringDamping.m_floats[i],(dofData->m_linearSpringDampingLimited[i]!=0));
} }
for (i=0;i<3;i++) for (i=0;i<3;i++)
{ {
dof->setStiffness(i+3,dofData->m_angularSpringStiffness.m_floats[i],dofData->m_angularSpringStiffnessLimited[i]); dof->setStiffness(i+3,dofData->m_angularSpringStiffness.m_floats[i],(dofData->m_angularSpringStiffnessLimited[i]!=0));
dof->setEquilibriumPoint(i+3,dofData->m_angularEquilibriumPoint.m_floats[i]); dof->setEquilibriumPoint(i+3,dofData->m_angularEquilibriumPoint.m_floats[i]);
dof->enableSpring(i+3,dofData->m_angularEnableSpring[i]!=0); dof->enableSpring(i+3,dofData->m_angularEnableSpring[i]!=0);
dof->setDamping(i+3,dofData->m_angularSpringDamping.m_floats[i],dofData->m_angularSpringDampingLimited[i]); dof->setDamping(i+3,dofData->m_angularSpringDamping.m_floats[i],dofData->m_angularSpringDampingLimited[i]);
@@ -1324,14 +1324,14 @@ void btWorldImporter::convertConstraintDouble(btTypedConstraintDoubleData* const
dof->setStiffness(i,dofData->m_linearSpringStiffness.m_floats[i],dofData->m_linearSpringStiffnessLimited[i]); dof->setStiffness(i,dofData->m_linearSpringStiffness.m_floats[i],dofData->m_linearSpringStiffnessLimited[i]);
dof->setEquilibriumPoint(i,dofData->m_linearEquilibriumPoint.m_floats[i]); dof->setEquilibriumPoint(i,dofData->m_linearEquilibriumPoint.m_floats[i]);
dof->enableSpring(i,dofData->m_linearEnableSpring[i]!=0); dof->enableSpring(i,dofData->m_linearEnableSpring[i]!=0);
dof->setDamping(i,dofData->m_linearSpringDamping.m_floats[i],dofData->m_linearSpringDampingLimited[i]); dof->setDamping(i,dofData->m_linearSpringDamping.m_floats[i],(dofData->m_linearSpringDampingLimited[i]!=0));
} }
for (i=0;i<3;i++) for (i=0;i<3;i++)
{ {
dof->setStiffness(i+3,dofData->m_angularSpringStiffness.m_floats[i],dofData->m_angularSpringStiffnessLimited[i]); dof->setStiffness(i+3,dofData->m_angularSpringStiffness.m_floats[i],(dofData->m_angularSpringStiffnessLimited[i]!=0));
dof->setEquilibriumPoint(i+3,dofData->m_angularEquilibriumPoint.m_floats[i]); dof->setEquilibriumPoint(i+3,dofData->m_angularEquilibriumPoint.m_floats[i]);
dof->enableSpring(i+3,dofData->m_angularEnableSpring[i]!=0); dof->enableSpring(i+3,dofData->m_angularEnableSpring[i]!=0);
dof->setDamping(i+3,dofData->m_angularSpringDamping.m_floats[i],dofData->m_angularSpringDampingLimited[i]); dof->setDamping(i+3,dofData->m_angularSpringDamping.m_floats[i],(dofData->m_angularSpringDampingLimited[i]!=0));
} }
} }

View File

@@ -29,7 +29,8 @@ struct MyDebugVec3
float y; float y;
float z; float z;
}; };
class MyDebugDrawer : public btIDebugDraw
ATTRIBUTE_ALIGNED16( class )MyDebugDrawer : public btIDebugDraw
{ {
CommonGraphicsApp* m_glApp; CommonGraphicsApp* m_glApp;
int m_debugMode; int m_debugMode;
@@ -40,6 +41,7 @@ class MyDebugDrawer : public btIDebugDraw
DefaultColors m_ourColors; DefaultColors m_ourColors;
public: public:
BT_DECLARE_ALIGNED_ALLOCATOR();
MyDebugDrawer(CommonGraphicsApp* app) MyDebugDrawer(CommonGraphicsApp* app)
: m_glApp(app) : m_glApp(app)

View File

@@ -1015,7 +1015,7 @@ bool BulletMJCFImporter::loadMJCF(const char* fileName, MJCFErrorLogger* logger,
b3FileUtils fu; b3FileUtils fu;
//bool fileFound = fu.findFile(fileName, relativeFileName, 1024); //bool fileFound = fu.findFile(fileName, relativeFileName, 1024);
bool fileFound = b3ResourcePath::findResourcePath(fileName,relativeFileName,1024); bool fileFound = (b3ResourcePath::findResourcePath(fileName,relativeFileName,1024)>0);
std::string xml_string; std::string xml_string;
m_data->m_pathPrefix[0] = 0; m_data->m_pathPrefix[0] = 0;
@@ -1334,7 +1334,8 @@ class btCompoundShape* BulletMJCFImporter::convertLinkCollisionShapes(int linkIn
//f-=c; //f-=c;
//t-=c; //t-=c;
btVector3 fromto[2] = {f,t}; btVector3 fromto[2] = {f,t};
btScalar radii[2] = {col->m_geometry.m_capsuleRadius,col->m_geometry.m_capsuleRadius}; btScalar radii[2] = {btScalar(col->m_geometry.m_capsuleRadius)
,btScalar(col->m_geometry.m_capsuleRadius)};
btMultiSphereShape* ms = new btMultiSphereShape(fromto,radii,2); btMultiSphereShape* ms = new btMultiSphereShape(fromto,radii,2);
childShape = ms; childShape = ms;

View File

@@ -33,7 +33,7 @@ GLInstanceGraphicsShape* btgCreateGraphicsShapeFromWavefrontObj(std::vector<tiny
int vtxBaseIndex = vertices->size(); int vtxBaseIndex = vertices->size();
if (f<0 && f>=shape.mesh.indices.size()) if (f<0 && f>=int(shape.mesh.indices.size()))
{ {
continue; continue;
} }
@@ -49,7 +49,7 @@ GLInstanceGraphicsShape* btgCreateGraphicsShapeFromWavefrontObj(std::vector<tiny
{ {
int uv0Index = shape.mesh.indices[f]*2+0; int uv0Index = shape.mesh.indices[f]*2+0;
int uv1Index = shape.mesh.indices[f]*2+1; int uv1Index = shape.mesh.indices[f]*2+1;
if (uv0Index>=0 && uv1Index>=0 && (uv0Index < shape.mesh.texcoords.size()) && (uv1Index < shape.mesh.texcoords.size())) if (uv0Index>=0 && uv1Index>=0 && (uv0Index < int(shape.mesh.texcoords.size()) && (uv1Index < shape.mesh.texcoords.size())))
{ {
vtx0.uv[0] = shape.mesh.texcoords[uv0Index]; vtx0.uv[0] = shape.mesh.texcoords[uv0Index];
vtx0.uv[1] = shape.mesh.texcoords[uv1Index]; vtx0.uv[1] = shape.mesh.texcoords[uv1Index];

View File

@@ -41,8 +41,10 @@ struct MyTexture
unsigned char* textureData; unsigned char* textureData;
}; };
struct BulletURDFInternalData ATTRIBUTE_ALIGNED16(struct) BulletURDFInternalData
{ {
BT_DECLARE_ALIGNED_ALLOCATOR();
UrdfParser m_urdfParser; UrdfParser m_urdfParser;
struct GUIHelperInterface* m_guiHelper; struct GUIHelperInterface* m_guiHelper;
char m_pathPrefix[1024]; char m_pathPrefix[1024];
@@ -119,7 +121,7 @@ bool BulletURDFImporter::loadURDF(const char* fileName, bool forceFixedBase)
b3FileUtils fu; b3FileUtils fu;
//bool fileFound = fu.findFile(fileName, relativeFileName, 1024); //bool fileFound = fu.findFile(fileName, relativeFileName, 1024);
bool fileFound = b3ResourcePath::findResourcePath(fileName,relativeFileName,1024); bool fileFound = (b3ResourcePath::findResourcePath(fileName,relativeFileName,1024))>0;
std::string xml_string; std::string xml_string;
m_data->m_pathPrefix[0] = 0; m_data->m_pathPrefix[0] = 0;
@@ -171,7 +173,7 @@ bool BulletURDFImporter::loadSDF(const char* fileName, bool forceFixedBase)
b3FileUtils fu; b3FileUtils fu;
//bool fileFound = fu.findFile(fileName, relativeFileName, 1024); //bool fileFound = fu.findFile(fileName, relativeFileName, 1024);
bool fileFound = b3ResourcePath::findResourcePath(fileName,relativeFileName,1024); bool fileFound = (b3ResourcePath::findResourcePath(fileName,relativeFileName,1024))>0;
std::string xml_string; std::string xml_string;
m_data->m_pathPrefix[0] = 0; m_data->m_pathPrefix[0] = 0;

View File

@@ -279,7 +279,9 @@ void b3Win32ThreadSupport::startThreads(const Win32ThreadConstructionInfo& threa
} }
SetThreadAffinityMask(handle, 1<<i); DWORD mask = 1;
mask = 1<<mask;
SetThreadAffinityMask(handle, mask);
threadStatus.m_taskId = i; threadStatus.m_taskId = i;
threadStatus.m_commandId = 0; threadStatus.m_commandId = 0;

View File

@@ -86,7 +86,7 @@ INCLUDE_DIRECTORIES(
) )
LINK_LIBRARIES( LINK_LIBRARIES(
Bullet3Common BulletWorldImporter BulletInverseDynamicsUtils BulletInverseDynamics BulletDynamics BulletCollision LinearMath BussIK Bullet3Common BulletWorldImporter BulletFileLoader BulletInverseDynamicsUtils BulletInverseDynamics BulletDynamics BulletCollision LinearMath BussIK
) )
IF (WIN32) IF (WIN32)
@@ -132,6 +132,7 @@ ENDIF(INTERNAL_ADD_POSTFIX_EXECUTABLE_NAMES)
INCLUDE_DIRECTORIES( INCLUDE_DIRECTORIES(
${BULLET_PHYSICS_SOURCE_DIR}/src ${BULLET_PHYSICS_SOURCE_DIR}/src
${BULLET_PHYSICS_SOURCE_DIR}/examples/ThirdPartyLibs ${BULLET_PHYSICS_SOURCE_DIR}/examples/ThirdPartyLibs
${BULLET_PHYSICS_SOURCE_DIR}/examples/ThirdPartyLibs/Glew
) )
ADD_DEFINITIONS(-DB3_USE_STANDALONE_EXAMPLE) ADD_DEFINITIONS(-DB3_USE_STANDALONE_EXAMPLE)

View File

@@ -1247,7 +1247,7 @@ bool PhysicsServerCommandProcessor::loadUrdf(const char* fileName, const btVecto
util->m_mb = mb; util->m_mb = mb;
for (int i = 0; i < bufferSizeInBytes; i++) for (int i = 0; i < bufferSizeInBytes; i++)
{ {
bufferServerToClient[i] = 0xcc; bufferServerToClient[i] = 0;//0xcc;
} }
util->m_memSerializer = new btDefaultSerializer(bufferSizeInBytes ,(unsigned char*)bufferServerToClient); util->m_memSerializer = new btDefaultSerializer(bufferSizeInBytes ,(unsigned char*)bufferServerToClient);
//disable serialization of the collision objects (they are too big, and the client likely doesn't need them); //disable serialization of the collision objects (they are too big, and the client likely doesn't need them);
@@ -1686,7 +1686,7 @@ bool PhysicsServerCommandProcessor::processCommand(const struct SharedMemoryComm
if ((clientCmd.m_updateFlags & REQUEST_PIXEL_ARGS_SET_SHADOW) != 0) if ((clientCmd.m_updateFlags & REQUEST_PIXEL_ARGS_SET_SHADOW) != 0)
{ {
m_data->m_visualConverter.setShadow(clientCmd.m_requestPixelDataArguments.m_hasShadow); m_data->m_visualConverter.setShadow((clientCmd.m_requestPixelDataArguments.m_hasShadow!=0));
} }
if ((clientCmd.m_updateFlags & REQUEST_PIXEL_ARGS_SET_AMBIENT_COEFF) != 0) if ((clientCmd.m_updateFlags & REQUEST_PIXEL_ARGS_SET_AMBIENT_COEFF) != 0)
@@ -1909,7 +1909,7 @@ bool PhysicsServerCommandProcessor::processCommand(const struct SharedMemoryComm
{ {
b3Printf("Processed CMD_LOAD_SDF:%s", sdfArgs.m_sdfFileName); b3Printf("Processed CMD_LOAD_SDF:%s", sdfArgs.m_sdfFileName);
} }
bool useMultiBody=(clientCmd.m_updateFlags & URDF_ARGS_USE_MULTIBODY) ? sdfArgs.m_useMultiBody : true; bool useMultiBody=(clientCmd.m_updateFlags & URDF_ARGS_USE_MULTIBODY) ? (sdfArgs.m_useMultiBody!=0) : true;
int flags = CUF_USE_SDF; //CUF_USE_URDF_INERTIA int flags = CUF_USE_SDF; //CUF_USE_URDF_INERTIA
bool completedOk = loadSdf(sdfArgs.m_sdfFileName,bufferServerToClient, bufferSizeInBytes, useMultiBody, flags); bool completedOk = loadSdf(sdfArgs.m_sdfFileName,bufferServerToClient, bufferSizeInBytes, useMultiBody, flags);
@@ -1958,8 +1958,8 @@ bool PhysicsServerCommandProcessor::processCommand(const struct SharedMemoryComm
initialOrn[2] = urdfArgs.m_initialOrientation[2]; initialOrn[2] = urdfArgs.m_initialOrientation[2];
initialOrn[3] = urdfArgs.m_initialOrientation[3]; initialOrn[3] = urdfArgs.m_initialOrientation[3];
} }
bool useMultiBody=(clientCmd.m_updateFlags & URDF_ARGS_USE_MULTIBODY) ? urdfArgs.m_useMultiBody : true; bool useMultiBody=(clientCmd.m_updateFlags & URDF_ARGS_USE_MULTIBODY) ? (urdfArgs.m_useMultiBody!=0) : true;
bool useFixedBase = (clientCmd.m_updateFlags & URDF_ARGS_USE_FIXED_BASE) ? urdfArgs.m_useFixedBase: false; bool useFixedBase = (clientCmd.m_updateFlags & URDF_ARGS_USE_FIXED_BASE) ? (urdfArgs.m_useFixedBase!=0): false;
int bodyUniqueId; int bodyUniqueId;
//load the actual URDF and send a report: completed or failed //load the actual URDF and send a report: completed or failed
bool completedOk = loadUrdf(urdfArgs.m_urdfFileName, bool completedOk = loadUrdf(urdfArgs.m_urdfFileName,
@@ -2596,6 +2596,11 @@ bool PhysicsServerCommandProcessor::processCommand(const struct SharedMemoryComm
m_data->m_dynamicsWorld->getSolverInfo().m_numIterations = clientCmd.m_physSimParamArgs.m_numSolverIterations; m_data->m_dynamicsWorld->getSolverInfo().m_numIterations = clientCmd.m_physSimParamArgs.m_numSolverIterations;
} }
if (clientCmd.m_updateFlags&SIM_PARAM_UPDATE_COLLISION_FILTER_MODE)
{
m_data->m_broadphaseCollisionFilterCallback->m_filterMode = clientCmd.m_physSimParamArgs.m_collisionFilterMode;
}
if (clientCmd.m_updateFlags & SIM_PARAM_UPDATE_USE_SPLIT_IMPULSE) if (clientCmd.m_updateFlags & SIM_PARAM_UPDATE_USE_SPLIT_IMPULSE)
{ {
m_data->m_dynamicsWorld->getSolverInfo().m_splitImpulse = clientCmd.m_physSimParamArgs.m_useSplitImpulse; m_data->m_dynamicsWorld->getSolverInfo().m_splitImpulse = clientCmd.m_physSimParamArgs.m_useSplitImpulse;
@@ -4003,7 +4008,7 @@ bool PhysicsServerCommandProcessor::processCommand(const struct SharedMemoryComm
{ {
b3Printf("Processed CMD_LOAD_MJCF:%s", mjcfArgs.m_mjcfFileName); b3Printf("Processed CMD_LOAD_MJCF:%s", mjcfArgs.m_mjcfFileName);
} }
bool useMultiBody=(clientCmd.m_updateFlags & URDF_ARGS_USE_MULTIBODY) ? mjcfArgs.m_useMultiBody : true; bool useMultiBody=(clientCmd.m_updateFlags & URDF_ARGS_USE_MULTIBODY) ? (mjcfArgs.m_useMultiBody!=0) : true;
int flags = CUF_USE_MJCF;//CUF_USE_URDF_INERTIA int flags = CUF_USE_MJCF;//CUF_USE_URDF_INERTIA
bool completedOk = loadMjcf(mjcfArgs.m_mjcfFileName,bufferServerToClient, bufferSizeInBytes, useMultiBody, flags); bool completedOk = loadMjcf(mjcfArgs.m_mjcfFileName,bufferServerToClient, bufferSizeInBytes, useMultiBody, flags);
if (completedOk) if (completedOk)

View File

@@ -1978,7 +1978,7 @@ void PhysicsServerExample::vrControllerButtonCallback(int controllerId, int butt
if (controllerId == gGraspingController && (button == 33)) if (controllerId == gGraspingController && (button == 33))
{ {
gVRGripperClosed =state; gVRGripperClosed =(state!=0);
} }
else else
{ {

View File

@@ -313,6 +313,7 @@ enum EnumSimParamUpdateFlags
SIM_PARAM_UPDATE_INTERNAL_SIMULATION_FLAGS=64, SIM_PARAM_UPDATE_INTERNAL_SIMULATION_FLAGS=64,
SIM_PARAM_UPDATE_USE_SPLIT_IMPULSE=128, SIM_PARAM_UPDATE_USE_SPLIT_IMPULSE=128,
SIM_PARAM_UPDATE_SPLIT_IMPULSE_PENETRATION_THRESHOLD = 256, SIM_PARAM_UPDATE_SPLIT_IMPULSE_PENETRATION_THRESHOLD = 256,
SIM_PARAM_UPDATE_COLLISION_FILTER_MODE=512
}; };
enum EnumLoadBunnyUpdateFlags enum EnumLoadBunnyUpdateFlags
@@ -341,6 +342,7 @@ struct SendPhysicsSimulationParameters
double m_splitImpulsePenetrationThreshold; double m_splitImpulsePenetrationThreshold;
int m_internalSimFlags; int m_internalSimFlags;
double m_defaultContactERP; double m_defaultContactERP;
int m_collisionFilterMode;
}; };
struct LoadBunnyArgs struct LoadBunnyArgs

View File

@@ -51,8 +51,8 @@ enum btContactManifoldTypes
///note that some pairs of objects might have more then one contact manifold. ///note that some pairs of objects might have more then one contact manifold.
ATTRIBUTE_ALIGNED128( class) btPersistentManifold : public btTypedObject //ATTRIBUTE_ALIGNED128( class) btPersistentManifold : public btTypedObject
//ATTRIBUTE_ALIGNED16( class) btPersistentManifold : public btTypedObject ATTRIBUTE_ALIGNED16( class) btPersistentManifold : public btTypedObject
{ {
btManifoldPoint m_pointCache[MANIFOLD_CACHE_SIZE]; btManifoldPoint m_pointCache[MANIFOLD_CACHE_SIZE];

View File

@@ -39,7 +39,7 @@ struct btMultiBodyJacobianData
}; };
class btMultiBodyConstraint ATTRIBUTE_ALIGNED16(class) btMultiBodyConstraint
{ {
protected: protected:
@@ -84,6 +84,8 @@ protected:
public: public:
BT_DECLARE_ALIGNED_ALLOCATOR();
btMultiBodyConstraint(btMultiBody* bodyA,btMultiBody* bodyB,int linkA, int linkB, int numRows, bool isUnilateral); btMultiBodyConstraint(btMultiBody* bodyA,btMultiBody* bodyB,int linkA, int linkB, int numRows, bool isUnilateral);
virtual ~btMultiBodyConstraint(); virtual ~btMultiBodyConstraint();

View File

@@ -22,7 +22,7 @@ subject to the following restrictions:
//#define BTMBP2PCONSTRAINT_BLOCK_ANGULAR_MOTION_TEST //#define BTMBP2PCONSTRAINT_BLOCK_ANGULAR_MOTION_TEST
class btMultiBodyPoint2Point : public btMultiBodyConstraint ATTRIBUTE_ALIGNED16(class) btMultiBodyPoint2Point : public btMultiBodyConstraint
{ {
protected: protected:
@@ -34,6 +34,8 @@ protected:
public: public:
BT_DECLARE_ALIGNED_ALLOCATOR();
btMultiBodyPoint2Point(btMultiBody* body, int link, btRigidBody* bodyB, const btVector3& pivotInA, const btVector3& pivotInB); btMultiBodyPoint2Point(btMultiBody* body, int link, btRigidBody* bodyB, const btVector3& pivotInA, const btVector3& pivotInB);
btMultiBodyPoint2Point(btMultiBody* bodyA, int linkA, btMultiBody* bodyB, int linkB, const btVector3& pivotInA, const btVector3& pivotInB); btMultiBodyPoint2Point(btMultiBody* bodyA, int linkA, btMultiBody* bodyB, int linkB, const btVector3& pivotInA, const btVector3& pivotInB);

View File

@@ -232,15 +232,18 @@ public:
int m_battach:1; // Attached int m_battach:1; // Attached
}; };
/* Link */ /* Link */
struct Link : Feature ATTRIBUTE_ALIGNED16(struct) Link : Feature
{ {
btVector3 m_c3; // gradient
Node* m_n[2]; // Node pointers Node* m_n[2]; // Node pointers
btScalar m_rl; // Rest length btScalar m_rl; // Rest length
int m_bbending:1; // Bending link int m_bbending:1; // Bending link
btScalar m_c0; // (ima+imb)*kLST btScalar m_c0; // (ima+imb)*kLST
btScalar m_c1; // rl^2 btScalar m_c1; // rl^2
btScalar m_c2; // |gradient|^2/c0 btScalar m_c2; // |gradient|^2/c0
btVector3 m_c3; // gradient
BT_DECLARE_ALIGNED_ALLOCATOR();
}; };
/* Face */ /* Face */
struct Face : Feature struct Face : Feature