Fix serialization issue with btGeneric6DofSpringConstraintData, due to typo

Skip btGeneric6DofSpringConstraintData parts of the data that will be invalid in .bullet files version 280 or older
This fixes Issue 618, thanks to cyrfer for the report.
minor improvements in premake build (name library output so multiple Visual Studio installations don't conflict)
remove msvc folder
This commit is contained in:
erwin.coumans 2012-07-24 04:07:25 +00:00
parent 78e1058b68
commit 10ed7bffd5
6 changed files with 37 additions and 22 deletions

View File

@ -793,7 +793,9 @@ bool btBulletWorldImporter::convertAllObjects( bParse::btBulletFile* bulletFile
if (shapePtr && *shapePtr)
{
btTransform startTransform;
colObjData->m_collisionObjectData.m_worldTransform.m_origin.m_floats[3] = 0.f;
startTransform.deSerializeDouble(colObjData->m_collisionObjectData.m_worldTransform);
// startTransform.setBasis(btMatrix3x3::getIdentity());
btCollisionShape* shape = (btCollisionShape*)*shapePtr;
if (shape->isNonMoving())
@ -834,7 +836,9 @@ bool btBulletWorldImporter::convertAllObjects( bParse::btBulletFile* bulletFile
if (shapePtr && *shapePtr)
{
btTransform startTransform;
colObjData->m_collisionObjectData.m_worldTransform.m_origin.m_floats[3] = 0.f;
startTransform.deSerializeFloat(colObjData->m_collisionObjectData.m_worldTransform);
// startTransform.setBasis(btMatrix3x3::getIdentity());
btCollisionShape* shape = (btCollisionShape*)*shapePtr;
if (shape->isNonMoving())
@ -878,7 +882,9 @@ bool btBulletWorldImporter::convertAllObjects( bParse::btBulletFile* bulletFile
if (shapePtr && *shapePtr)
{
btTransform startTransform;
colObjData->m_worldTransform.m_origin.m_floats[3] = 0.f;
startTransform.deSerializeDouble(colObjData->m_worldTransform);
btCollisionShape* shape = (btCollisionShape*)*shapePtr;
btCollisionObject* body = createCollisionObject(startTransform,shape,colObjData->m_name);
body->setFriction(btScalar(colObjData->m_friction));
@ -907,7 +913,9 @@ bool btBulletWorldImporter::convertAllObjects( bParse::btBulletFile* bulletFile
if (shapePtr && *shapePtr)
{
btTransform startTransform;
colObjData->m_worldTransform.m_origin.m_floats[3] = 0.f;
startTransform.deSerializeFloat(colObjData->m_worldTransform);
btCollisionShape* shape = (btCollisionShape*)*shapePtr;
btCollisionObject* body = createCollisionObject(startTransform,shape,colObjData->m_name);
@ -1075,7 +1083,9 @@ bool btBulletWorldImporter::convertAllObjects( bParse::btBulletFile* bulletFile
case D6_SPRING_CONSTRAINT_TYPE:
{
btGeneric6DofSpringConstraintData* dofData = (btGeneric6DofSpringConstraintData*)constraintData;
int sz = sizeof(btGeneric6DofSpringConstraintData);
btGeneric6DofSpringConstraint* dof = 0;
if (rbA && rbB)
@ -1097,18 +1107,22 @@ bool btBulletWorldImporter::convertAllObjects( bParse::btBulletFile* bulletFile
linLowerLimit.deSerializeFloat(dofData->m_6dofData.m_linearLowerLimit);
linUpperlimit.deSerializeFloat(dofData->m_6dofData.m_linearUpperLimit);
angLowerLimit.setW(0.f);
dof->setAngularLowerLimit(angLowerLimit);
dof->setAngularUpperLimit(angUpperLimit);
dof->setLinearLowerLimit(linLowerLimit);
dof->setLinearUpperLimit(linUpperlimit);
int i;
for (i=0;i<6;i++)
if (bulletFile2->getVersion()>280)
{
dof->setStiffness(i,dofData->m_springStiffness[i]);
dof->setEquilibriumPoint(i,dofData->m_equilibriumPoint[i]);
dof->enableSpring(i,dofData->m_springEnabled[i]!=0);
dof->setDamping(i,dofData->m_springDamping[i]);
for (i=0;i<6;i++)
{
dof->setStiffness(i,dofData->m_springStiffness[i]);
dof->setEquilibriumPoint(i,dofData->m_equilibriumPoint[i]);
dof->enableSpring(i,dofData->m_springEnabled[i]!=0);
dof->setDamping(i,dofData->m_springDamping[i]);
}
}
}

View File

@ -49,8 +49,8 @@ solution "0BulletSolution"
configuration "Debug"
flags { "Symbols", "StaticRuntime" , "NoMinimalRebuild", "NoEditAndContinue" ,"FloatFast"}
--platforms {"x32", "x64"}
platforms {"x32"}
platforms {"x32", "x64"}
--platforms {"x32"}
configuration {"Windows"}
defines { "_CRT_SECURE_NO_WARNINGS","_CRT_SECURE_NO_DEPRECATE"}
@ -83,17 +83,17 @@ solution "0BulletSolution"
end
configuration "x32"
targetsuffix ("x32" .. postfix)
configuration "x64"
targetsuffix ("x64" .. postfix)
configuration {"x64", "debug"}
targetsuffix ("x64Debug" .. postfix)
configuration {"x64", "release"}
targetsuffix ("x64" .. postfix)
configuration {"x32", "debug"}
targetsuffix ("Debug" .. postfix)
configuration {"x32"}
targetsuffix ("_" .. _ACTION)
configuration "x64"
targetsuffix ("_" .. _ACTION .. "_64" )
configuration {"x64", "debug"}
targetsuffix ("_" .. _ACTION .. "_x64_debug")
configuration {"x64", "release"}
targetsuffix ("_" .. _ACTION .. "_x64_release" )
configuration {"x32", "debug"}
targetsuffix ("_" .. _ACTION .. "_debug" )
configuration{}

View File

@ -4,7 +4,7 @@ rem premake4 --no-pedemos vs2008
rem premake4 --no-bulletlibs --no-pelibs vs2008
rem premake4 --with-nacl vs2008
premake4 vs2008
premake4 --with-demos vs2008
pause

View File

@ -95,7 +95,7 @@ SIMD_FORCE_INLINE const char* btGeneric6DofSpringConstraint::serialize(void* dat
dof->m_springEnabled[i] = m_springEnabled[i]? 1 : 0;
dof->m_springStiffness[i] = m_springStiffness[i];
}
return "btGeneric6DofConstraintData";
return "btGeneric6DofSpringConstraintData";
}
#endif // BT_GENERIC_6DOF_SPRING_CONSTRAINT_H

View File

@ -16,9 +16,10 @@ subject to the following restrictions:
#ifndef BT_TYPED_CONSTRAINT_H
#define BT_TYPED_CONSTRAINT_H
class btRigidBody;
#include "LinearMath/btScalar.h"
#include "btSolverConstraint.h"
#include "BulletDynamics/Dynamics/btRigidBody.h"
class btSerializer;

View File

@ -17,7 +17,7 @@ subject to the following restrictions:
#define BT_SOFTBODY_FLOAT_DATA
#include "BulletCollision/CollisionDispatch/btCollisionObject.h"
#include "BulletDynamics/Dynamics/btRigidBody.h"
struct SoftBodyMaterialData