fixes in btBulletXmlWorldImporter, and add premake4 support for the related demo

This commit is contained in:
erwin.coumans
2012-09-22 05:27:35 +00:00
parent 0fa444e851
commit 182c3034de
5 changed files with 35 additions and 23 deletions

View File

@@ -83,6 +83,7 @@ IF (NOT INTERNAL_CREATE_DISTRIBUTABLE_MSVC_PROJECTFILES AND NOT INTERNAL_UPDATE_
TARGET AppBulletXmlImportDemo TARGET AppBulletXmlImportDemo
POST_BUILD POST_BUILD
COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${BULLET_PHYSICS_SOURCE_DIR}/Demos/BulletXmlImportDemo/bullet_basic.xml ${CMAKE_CURRENT_BINARY_DIR}/bullet_basic.xml COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${BULLET_PHYSICS_SOURCE_DIR}/Demos/BulletXmlImportDemo/bullet_basic.xml ${CMAKE_CURRENT_BINARY_DIR}/bullet_basic.xml
COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${BULLET_PHYSICS_SOURCE_DIR}/Demos/BulletXmlImportDemo/bullet_basic.xml ${CMAKE_CURRENT_BINARY_DIR}/Debug/bullet_basic.xml
) )
ENDIF () ENDIF ()

View File

@@ -90,6 +90,7 @@ end
createDemos({"SerializeDemo"},{"../Extras/Serialize/BulletFileLoader","../Extras/Serialize/BulletWorldImporter","../src","OpenGL"},{"OpenGLSupport","BulletWorldImporter", "BulletFileLoader", "BulletSoftBody", "BulletDynamics", "BulletCollision", "LinearMath"}) createDemos({"SerializeDemo"},{"../Extras/Serialize/BulletFileLoader","../Extras/Serialize/BulletWorldImporter","../src","OpenGL"},{"OpenGLSupport","BulletWorldImporter", "BulletFileLoader", "BulletSoftBody", "BulletDynamics", "BulletCollision", "LinearMath"})
createDemos({"BulletXmlImportDemo"},{"../Extras/Serialize/BulletFileLoader","../Extras/Serialize/BulletXmlWorldImporter", "../Extras/Serialize/BulletWorldImporter","../src","OpenGL"},{"OpenGLSupport","BulletXmlWorldImporter","BulletWorldImporter", "BulletFileLoader", "BulletSoftBody", "BulletDynamics", "BulletCollision", "LinearMath"})
include "OpenGL" include "OpenGL"

View File

@@ -126,8 +126,8 @@ void btBulletXmlWorldImporter::deSerializeVector3FloatData(TiXmlNode* pParent,bt
#define SET_POINTER_VALUE(xmlnode, targetdata, argname, pointertype) \ #define SET_POINTER_VALUE(xmlnode, targetdata, argname, pointertype) \
{\ {\
TiXmlNode* node;\ TiXmlNode* node = xmlnode->FirstChild(#argname);\
if ((node)= xmlnode->FirstChild(#argname))\ if (node)\
{\ {\
const char* txt = (node)->ToElement()->GetText();\ const char* txt = (node)->ToElement()->GetText();\
(targetdata).argname= (pointertype) (int) atof(txt);\ (targetdata).argname= (pointertype) (int) atof(txt);\
@@ -213,7 +213,8 @@ void btBulletXmlWorldImporter::deSerializeCollisionShapeData(TiXmlNode* pParent,
void btBulletXmlWorldImporter::deSerializeConvexHullShapeData(TiXmlNode* pParent) void btBulletXmlWorldImporter::deSerializeConvexHullShapeData(TiXmlNode* pParent)
{ {
int ptr; int ptr;
btAssert(get_int_attribute_by_name(pParent->ToElement(),"pointer",&ptr)); get_int_attribute_by_name(pParent->ToElement(),"pointer",&ptr);
btConvexHullShapeData* convexHullData = (btConvexHullShapeData*)btAlignedAlloc(sizeof(btConvexHullShapeData), 16); btConvexHullShapeData* convexHullData = (btConvexHullShapeData*)btAlignedAlloc(sizeof(btConvexHullShapeData), 16);
TiXmlNode* xmlConvexInt = pParent->FirstChild("m_convexInternalShapeData"); TiXmlNode* xmlConvexInt = pParent->FirstChild("m_convexInternalShapeData");
@@ -239,7 +240,7 @@ void btBulletXmlWorldImporter::deSerializeConvexHullShapeData(TiXmlNode* pParent
void btBulletXmlWorldImporter::deSerializeCompoundShapeChildData(TiXmlNode* pParent) void btBulletXmlWorldImporter::deSerializeCompoundShapeChildData(TiXmlNode* pParent)
{ {
int ptr; int ptr;
btAssert(get_int_attribute_by_name(pParent->ToElement(),"pointer",&ptr)); get_int_attribute_by_name(pParent->ToElement(),"pointer",&ptr);
btCompoundShapeChildData* compoundChildData = (btCompoundShapeChildData*) btAlignedAlloc(sizeof(btCompoundShapeChildData),16); btCompoundShapeChildData* compoundChildData = (btCompoundShapeChildData*) btAlignedAlloc(sizeof(btCompoundShapeChildData),16);
@@ -257,7 +258,7 @@ void btBulletXmlWorldImporter::deSerializeCompoundShapeChildData(TiXmlNode* pPar
void btBulletXmlWorldImporter::deSerializeCompoundShapeData(TiXmlNode* pParent) void btBulletXmlWorldImporter::deSerializeCompoundShapeData(TiXmlNode* pParent)
{ {
int ptr; int ptr;
btAssert(get_int_attribute_by_name(pParent->ToElement(),"pointer",&ptr)); get_int_attribute_by_name(pParent->ToElement(),"pointer",&ptr);
btCompoundShapeData* compoundData = (btCompoundShapeData*) btAlignedAlloc(sizeof(btCompoundShapeData),16); btCompoundShapeData* compoundData = (btCompoundShapeData*) btAlignedAlloc(sizeof(btCompoundShapeData),16);
@@ -277,7 +278,7 @@ void btBulletXmlWorldImporter::deSerializeCompoundShapeData(TiXmlNode* pParent)
void btBulletXmlWorldImporter::deSerializeStaticPlaneShapeData(TiXmlNode* pParent) void btBulletXmlWorldImporter::deSerializeStaticPlaneShapeData(TiXmlNode* pParent)
{ {
int ptr; int ptr;
btAssert(get_int_attribute_by_name(pParent->ToElement(),"pointer",&ptr)); get_int_attribute_by_name(pParent->ToElement(),"pointer",&ptr);
btStaticPlaneShapeData* planeData = (btStaticPlaneShapeData*) btAlignedAlloc(sizeof(btStaticPlaneShapeData),16); btStaticPlaneShapeData* planeData = (btStaticPlaneShapeData*) btAlignedAlloc(sizeof(btStaticPlaneShapeData),16);
@@ -301,8 +302,9 @@ void btBulletXmlWorldImporter::deSerializeDynamicsWorldData(TiXmlNode* pParent)
void btBulletXmlWorldImporter::deSerializeConvexInternalShapeData(TiXmlNode* pParent) void btBulletXmlWorldImporter::deSerializeConvexInternalShapeData(TiXmlNode* pParent)
{ {
int ptr; int ptr=0;
btAssert(get_int_attribute_by_name(pParent->ToElement(),"pointer",&ptr)); get_int_attribute_by_name(pParent->ToElement(),"pointer",&ptr);
btConvexInternalShapeData* convexShape = (btConvexInternalShapeData*) btAlignedAlloc(sizeof(btConvexInternalShapeData),16); btConvexInternalShapeData* convexShape = (btConvexInternalShapeData*) btAlignedAlloc(sizeof(btConvexInternalShapeData),16);
memset(convexShape,0,sizeof(btConvexInternalShapeData)); memset(convexShape,0,sizeof(btConvexInternalShapeData));
@@ -339,8 +341,9 @@ enum btTypedConstraintType
void btBulletXmlWorldImporter::deSerializeGeneric6DofConstraintData(TiXmlNode* pParent) void btBulletXmlWorldImporter::deSerializeGeneric6DofConstraintData(TiXmlNode* pParent)
{ {
int ptr; int ptr=0;
btAssert(get_int_attribute_by_name(pParent->ToElement(),"pointer",&ptr)); get_int_attribute_by_name(pParent->ToElement(),"pointer",&ptr);
btGeneric6DofConstraintData* dof6Data = (btGeneric6DofConstraintData*)btAlignedAlloc(sizeof(btGeneric6DofConstraintData),16); btGeneric6DofConstraintData* dof6Data = (btGeneric6DofConstraintData*)btAlignedAlloc(sizeof(btGeneric6DofConstraintData),16);
@@ -378,8 +381,12 @@ void btBulletXmlWorldImporter::deSerializeGeneric6DofConstraintData(TiXmlNode* p
void btBulletXmlWorldImporter::deSerializeRigidBodyFloatData(TiXmlNode* pParent) void btBulletXmlWorldImporter::deSerializeRigidBodyFloatData(TiXmlNode* pParent)
{ {
int ptr; int ptr=0;
btAssert(get_int_attribute_by_name(pParent->ToElement(),"pointer",&ptr)); if (!get_int_attribute_by_name(pParent->ToElement(),"pointer",&ptr))
{
m_fileOk = false;
return;
}
btRigidBodyData* rbData = (btRigidBodyData*)btAlignedAlloc(sizeof(btRigidBodyData),16); btRigidBodyData* rbData = (btRigidBodyData*)btAlignedAlloc(sizeof(btRigidBodyData),16);
@@ -566,7 +573,7 @@ void btBulletXmlWorldImporter::auto_serialize_root_level_children(TiXmlNode* pPa
if (!stricmp(pChild->Value(),"btVector3FloatData")) if (!stricmp(pChild->Value(),"btVector3FloatData"))
{ {
int ptr; int ptr;
btAssert(get_int_attribute_by_name(pChild->ToElement(),"pointer",&ptr)); get_int_attribute_by_name(pChild->ToElement(),"pointer",&ptr);
btAlignedObjectArray<btVector3FloatData> v; btAlignedObjectArray<btVector3FloatData> v;
deSerializeVector3FloatData(pChild,v); deSerializeVector3FloatData(pChild,v);
@@ -648,6 +655,13 @@ void btBulletXmlWorldImporter::auto_serialize_root_level_children(TiXmlNode* pPa
} }
} }
for (int i=0;i<this->m_collisionShapeData.size();i++)
{
btCollisionShapeData* shapeData = m_collisionShapeData[i];
fixupCollisionDataPointers(shapeData);
}
///now fixup pointers ///now fixup pointers
for (int i=0;i<m_rigidBodyData.size();i++) for (int i=0;i<m_rigidBodyData.size();i++)
{ {
@@ -664,12 +678,7 @@ void btBulletXmlWorldImporter::auto_serialize_root_level_children(TiXmlNode* pPa
} }
} }
for (int i=0;i<this->m_collisionShapeData.size();i++)
{
btCollisionShapeData* shapeData = m_collisionShapeData[i];
fixupCollisionDataPointers(shapeData);
}
for (int i=0;i<m_constraintData.size();i++) for (int i=0;i<m_constraintData.size();i++)
{ {
@@ -773,7 +782,7 @@ bool btBulletXmlWorldImporter::loadFile(const char* fileName)
{ {
m_fileOk = true; m_fileOk = true;
int itemcount; int itemcount;
assert(get_int_attribute_by_name(doc.FirstChildElement()->ToElement(),"itemcount", &itemcount)); get_int_attribute_by_name(doc.FirstChildElement()->ToElement(),"itemcount", &itemcount);
auto_serialize(&doc); auto_serialize(&doc);
return m_fileOk; return m_fileOk;

View File

@@ -4,3 +4,5 @@ include "ConvexDecomposition"
include "Serialize/BulletFileLoader" include "Serialize/BulletFileLoader"
include "Serialize/BulletWorldImporter" include "Serialize/BulletWorldImporter"
include "Serialize/BulletXmlWorldImporter"

View File

@@ -1231,7 +1231,6 @@ btScalar btSequentialImpulseConstraintSolver::solveSingleIteration(int iteration
int numNonContactPool = m_tmpSolverNonContactConstraintPool.size(); int numNonContactPool = m_tmpSolverNonContactConstraintPool.size();
int numConstraintPool = m_tmpSolverContactConstraintPool.size(); int numConstraintPool = m_tmpSolverContactConstraintPool.size();
int numFrictionPool = m_tmpSolverContactFrictionConstraintPool.size(); int numFrictionPool = m_tmpSolverContactFrictionConstraintPool.size();
int numRollingFrictionPool = m_tmpSolverContactRollingFrictionConstraintPool.size();
if (infoGlobal.m_solverMode & SOLVER_RANDMIZE_ORDER) if (infoGlobal.m_solverMode & SOLVER_RANDMIZE_ORDER)
{ {