diff --git a/CMakeLists.txt b/CMakeLists.txt index 07e8c8cb8..ba7c42f95 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,6 +9,13 @@ IF (NOT CMAKE_BUILD_TYPE) ENDIF (NOT CMAKE_BUILD_TYPE) +OPTION(USE_DOUBLE_PRECISION "Use double precision" OFF) + +IF (USE_DOUBLE_PRECISION) +ADD_DEFINITIONS( -DBT_USE_DOUBLE_PRECISION) +ENDIF (USE_DOUBLE_PRECISION) + + IF (WIN32) OPTION(USE_GLUT "Use Glut" OFF) @@ -63,6 +70,7 @@ IF (USE_GLUT) IF (MSVC) MESSAGE ("GLUT NOT FOUND, trying to use Bullet/Glut/glut32.lib for MSVC") SET(GLUT_glut_LIBRARY ${BULLET_PHYSICS_SOURCE_DIR}/Glut/glut32.lib) + #SET(GLUT_glut_LIBRARY ${BULLET_PHYSICS_SOURCE_DIR}/Glut/glut64.lib) ENDIF (MSVC) ENDIF (GLUT_FOUND) diff --git a/Demos/ConvexDecompositionDemo/ConvexDecompositionDemo.cpp b/Demos/ConvexDecompositionDemo/ConvexDecompositionDemo.cpp index e919639ef..411176512 100644 --- a/Demos/ConvexDecompositionDemo/ConvexDecompositionDemo.cpp +++ b/Demos/ConvexDecompositionDemo/ConvexDecompositionDemo.cpp @@ -439,6 +439,7 @@ void ConvexDecompositionDemo::initPhysics(const char* filename) cb.process(desc); //now create some bodies + if (1) { btCompoundShape* compound = new btCompoundShape(false); m_collisionShapes.push_back (compound); @@ -456,6 +457,7 @@ void ConvexDecompositionDemo::initPhysics(const char* filename) btRigidBody* body = localCreateRigidBody( 1.0, trans,convexShape); } +#if 1 btScalar mass=10.f; trans.setOrigin(-convexDecompositionObjectOffset); btRigidBody* body = localCreateRigidBody( mass, trans,compound); @@ -470,7 +472,7 @@ void ConvexDecompositionDemo::initPhysics(const char* filename) trans.setOrigin(-convexDecompositionObjectOffset); body = localCreateRigidBody( mass, trans,compound); body->setCollisionFlags(body->getCollisionFlags() | btCollisionObject::CF_CUSTOM_MATERIAL_CALLBACK); - +#endif } @@ -499,8 +501,13 @@ void ConvexDecompositionDemo::initPhysics(const char* filename) setupEmptyDynamicsWorld(); btBulletFileLoader* fileLoader = new btBulletFileLoader(m_dynamicsWorld); + fileLoader->setVerboseMode(true); fileLoader->loadFileFromMemory("testFile.bullet"); + //fileLoader->loadFileFromMemory("testFile64Double.bullet"); + //fileLoader->loadFileFromMemory("testFile64Single.bullet"); + //fileLoader->loadFileFromMemory("testFile32Single.bullet"); + diff --git a/Demos/ConvexDecompositionDemo/testFile32Single.bullet b/Demos/ConvexDecompositionDemo/testFile32Single.bullet new file mode 100644 index 000000000..75f1104c4 Binary files /dev/null and b/Demos/ConvexDecompositionDemo/testFile32Single.bullet differ diff --git a/Demos/ConvexDecompositionDemo/testFile64Double.bullet b/Demos/ConvexDecompositionDemo/testFile64Double.bullet new file mode 100644 index 000000000..55b7d783b Binary files /dev/null and b/Demos/ConvexDecompositionDemo/testFile64Double.bullet differ diff --git a/Demos/ConvexDecompositionDemo/testFile64Single.bullet b/Demos/ConvexDecompositionDemo/testFile64Single.bullet new file mode 100644 index 000000000..aa028bac4 Binary files /dev/null and b/Demos/ConvexDecompositionDemo/testFile64Single.bullet differ diff --git a/Demos/OpenGL/GL_DialogDynamicsWorld.cpp b/Demos/OpenGL/GL_DialogDynamicsWorld.cpp index 2625ca681..5929644d4 100644 --- a/Demos/OpenGL/GL_DialogDynamicsWorld.cpp +++ b/Demos/OpenGL/GL_DialogDynamicsWorld.cpp @@ -343,7 +343,7 @@ static int gPickingConstraintId = 0; static btVector3 gOldPickingPos; static btVector3 gHitPos(-1,-1,-1); -static float gOldPickingDist = 0.f; +static btScalar gOldPickingDist = 0.f; bool GL_DialogDynamicsWorld::mouseFunc(int button, int state, int x, int y) { @@ -719,7 +719,7 @@ void GL_DialogDynamicsWorld::mouseMotionFunc(int x,int y) } - float dx, dy; + btScalar dx, dy; dx = btScalar(x) - m_mouseOldX; dy = btScalar(y) - m_mouseOldY; diff --git a/Extras/CMakeLists.txt b/Extras/CMakeLists.txt index 919f57652..93f551273 100644 --- a/Extras/CMakeLists.txt +++ b/Extras/CMakeLists.txt @@ -1 +1 @@ -SUBDIRS( glui ConvexDecomposition BulletColladaConverter LibXML COLLADA_DOM GIMPACTUtils Serialize) +SUBDIRS( Serialize ConvexDecomposition GIMPACTUtils ) diff --git a/Extras/Serialize/BulletFileLoader/autogenerated/bullet.h b/Extras/Serialize/BulletFileLoader/autogenerated/bullet.h index 421c6ffd0..fd060227b 100644 --- a/Extras/Serialize/BulletFileLoader/autogenerated/bullet.h +++ b/Extras/Serialize/BulletFileLoader/autogenerated/bullet.h @@ -22,11 +22,12 @@ #include "bullet_PointerArray.h" #include "bullet_btPhysicsSystem.h" #include "bullet_ListBase.h" -#include "bullet_btVector3Data.h" #include "bullet_btVector3FloatData.h" #include "bullet_btVector3DoubleData.h" -#include "bullet_btMatrix3x3Data.h" -#include "bullet_btTransformData.h" +#include "bullet_btMatrix3x3FloatData.h" +#include "bullet_btMatrix3x3DoubleData.h" +#include "bullet_btTransformFloatData.h" +#include "bullet_btTransformDoubleData.h" #include "bullet_btCollisionShapeData.h" #include "bullet_btConvexInternalShapeData.h" #include "bullet_btPositionAndRadius.h" @@ -37,6 +38,8 @@ #include "bullet_btStridingMeshInterfaceData.h" #include "bullet_btTriangleMeshShapeData.h" #include "bullet_btConvexHullShapeData.h" -#include "bullet_btCollisionObjectData.h" -#include "bullet_btRigidBodyData.h" +#include "bullet_btCollisionObjectDoubleData.h" +#include "bullet_btCollisionObjectFloatData.h" +#include "bullet_btRigidBodyFloatData.h" +#include "bullet_btRigidBodyDoubleData.h" #endif//__BULLET_H__ \ No newline at end of file diff --git a/Extras/Serialize/BulletFileLoader/autogenerated/bullet_Common.h b/Extras/Serialize/BulletFileLoader/autogenerated/bullet_Common.h index 8cc49ac45..744fb6201 100644 --- a/Extras/Serialize/BulletFileLoader/autogenerated/bullet_Common.h +++ b/Extras/Serialize/BulletFileLoader/autogenerated/bullet_Common.h @@ -29,11 +29,12 @@ namespace Bullet { class PointerArray; class btPhysicsSystem; class ListBase; - class btVector3Data; class btVector3FloatData; class btVector3DoubleData; - class btMatrix3x3Data; - class btTransformData; + class btMatrix3x3FloatData; + class btMatrix3x3DoubleData; + class btTransformFloatData; + class btTransformDoubleData; class btCollisionShapeData; class btConvexInternalShapeData; class btPositionAndRadius; @@ -44,7 +45,9 @@ namespace Bullet { class btStridingMeshInterfaceData; class btTriangleMeshShapeData; class btConvexHullShapeData; - class btCollisionObjectData; - class btRigidBodyData; + class btCollisionObjectDoubleData; + class btCollisionObjectFloatData; + class btRigidBodyFloatData; + class btRigidBodyDoubleData; } #endif//__BULLETCOMMON_H__ \ No newline at end of file diff --git a/Extras/Serialize/BulletFileLoader/autogenerated/bullet_btCollisionObjectDoubleData.h b/Extras/Serialize/BulletFileLoader/autogenerated/bullet_btCollisionObjectDoubleData.h new file mode 100644 index 000000000..95751613b --- /dev/null +++ b/Extras/Serialize/BulletFileLoader/autogenerated/bullet_btCollisionObjectDoubleData.h @@ -0,0 +1,64 @@ +/* Copyright (C) 2006-2009 Erwin Coumans & Charlie C +* +* This software is provided 'as-is', without any express or implied +* warranty. In no event will the authors be held liable for any damages +* arising from the use of this software. +* +* Permission is granted to anyone to use this software for any purpose, +* including commercial applications, and to alter it and redistribute it +* freely, subject to the following restrictions: +* +* 1. The origin of this software must not be misrepresented; you must not +* claim that you wrote the original software. If you use this software +* in a product, an acknowledgment in the product documentation would be +* appreciated but is not required. +* 2. Altered source versions must be plainly marked as such, and must not be +* misrepresented as being the original software. +* 3. This notice may not be removed or altered from any source distribution. +*/ +// Auto generated from makesdna dna.c +#ifndef __BULLET_BTCOLLISIONOBJECTDOUBLEDATA__H__ +#define __BULLET_BTCOLLISIONOBJECTDOUBLEDATA__H__ + + +// -------------------------------------------------- // +#include "bullet_Common.h" +#include "bullet_btTransformDoubleData.h" +#include "bullet_btVector3DoubleData.h" + +namespace Bullet { + + + // ---------------------------------------------- // + class btCollisionObjectDoubleData + { + public: + void *m_broadphaseHandle; + void *m_collisionShape; + btCollisionShapeData *m_rootCollisionShape; + void *m_userObjectPointer; + btTransformDoubleData m_worldTransform; + btTransformDoubleData m_interpolationWorldTransform; + btVector3DoubleData m_interpolationLinearVelocity; + btVector3DoubleData m_interpolationAngularVelocity; + btVector3DoubleData m_anisotropicFriction; + double m_contactProcessingThreshold; + double m_deactivationTime; + double m_friction; + double m_restitution; + double m_hitFraction; + double m_ccdSweptSphereRadius; + double m_ccdMotionThreshold; + int m_hasAnisotropicFriction; + int m_collisionFlags; + int m_islandTag1; + int m_companionId; + int m_activationState1; + int m_internalType; + int m_checkCollideWith; + char m_padding[4]; + }; +} + + +#endif//__BULLET_BTCOLLISIONOBJECTDOUBLEDATA__H__ diff --git a/Extras/Serialize/BulletFileLoader/autogenerated/bullet_btCollisionObjectFloatData.h b/Extras/Serialize/BulletFileLoader/autogenerated/bullet_btCollisionObjectFloatData.h new file mode 100644 index 000000000..450a8b793 --- /dev/null +++ b/Extras/Serialize/BulletFileLoader/autogenerated/bullet_btCollisionObjectFloatData.h @@ -0,0 +1,63 @@ +/* Copyright (C) 2006-2009 Erwin Coumans & Charlie C +* +* This software is provided 'as-is', without any express or implied +* warranty. In no event will the authors be held liable for any damages +* arising from the use of this software. +* +* Permission is granted to anyone to use this software for any purpose, +* including commercial applications, and to alter it and redistribute it +* freely, subject to the following restrictions: +* +* 1. The origin of this software must not be misrepresented; you must not +* claim that you wrote the original software. If you use this software +* in a product, an acknowledgment in the product documentation would be +* appreciated but is not required. +* 2. Altered source versions must be plainly marked as such, and must not be +* misrepresented as being the original software. +* 3. This notice may not be removed or altered from any source distribution. +*/ +// Auto generated from makesdna dna.c +#ifndef __BULLET_BTCOLLISIONOBJECTFLOATDATA__H__ +#define __BULLET_BTCOLLISIONOBJECTFLOATDATA__H__ + + +// -------------------------------------------------- // +#include "bullet_Common.h" +#include "bullet_btTransformFloatData.h" +#include "bullet_btVector3FloatData.h" + +namespace Bullet { + + + // ---------------------------------------------- // + class btCollisionObjectFloatData + { + public: + void *m_broadphaseHandle; + void *m_collisionShape; + btCollisionShapeData *m_rootCollisionShape; + void *m_userObjectPointer; + btTransformFloatData m_worldTransform; + btTransformFloatData m_interpolationWorldTransform; + btVector3FloatData m_interpolationLinearVelocity; + btVector3FloatData m_interpolationAngularVelocity; + btVector3FloatData m_anisotropicFriction; + float m_contactProcessingThreshold; + float m_deactivationTime; + float m_friction; + float m_restitution; + float m_hitFraction; + float m_ccdSweptSphereRadius; + float m_ccdMotionThreshold; + int m_hasAnisotropicFriction; + int m_collisionFlags; + int m_islandTag1; + int m_companionId; + int m_activationState1; + int m_internalType; + int m_checkCollideWith; + }; +} + + +#endif//__BULLET_BTCOLLISIONOBJECTFLOATDATA__H__ diff --git a/Extras/Serialize/BulletFileLoader/autogenerated/bullet_btConvexHullShapeData.h b/Extras/Serialize/BulletFileLoader/autogenerated/bullet_btConvexHullShapeData.h index d3d425420..8fb91c5e6 100644 --- a/Extras/Serialize/BulletFileLoader/autogenerated/bullet_btConvexHullShapeData.h +++ b/Extras/Serialize/BulletFileLoader/autogenerated/bullet_btConvexHullShapeData.h @@ -33,9 +33,10 @@ namespace Bullet { { public: btConvexInternalShapeData m_convexInternalShapeData; - btVector3Data *m_unscaledPointsPtr; + btVector3FloatData *m_unscaledPointsFloatPtr; + btVector3DoubleData *m_unscaledPointsDoublePtr; int m_numUnscaledPoints; - char m_padding[4]; + char m_padding3[4]; }; } diff --git a/Extras/Serialize/BulletFileLoader/autogenerated/bullet_btConvexInternalShapeData.h b/Extras/Serialize/BulletFileLoader/autogenerated/bullet_btConvexInternalShapeData.h index 0ad0266ce..2a7536d69 100644 --- a/Extras/Serialize/BulletFileLoader/autogenerated/bullet_btConvexInternalShapeData.h +++ b/Extras/Serialize/BulletFileLoader/autogenerated/bullet_btConvexInternalShapeData.h @@ -24,7 +24,7 @@ // -------------------------------------------------- // #include "bullet_Common.h" #include "bullet_btCollisionShapeData.h" -#include "bullet_btVector3Data.h" +#include "bullet_btVector3FloatData.h" namespace Bullet { @@ -34,10 +34,10 @@ namespace Bullet { { public: btCollisionShapeData m_collisionShapeData; - btVector3Data m_localScaling; - btVector3Data m_implicitShapeDimensions; - btScalar m_collisionMargin; - char m_padding[4]; + btVector3FloatData m_localScaling; + btVector3FloatData m_implicitShapeDimensions; + float m_collisionMargin; + int m_padding; }; } diff --git a/Extras/Serialize/BulletFileLoader/autogenerated/bullet_btMatrix3x3DoubleData.h b/Extras/Serialize/BulletFileLoader/autogenerated/bullet_btMatrix3x3DoubleData.h new file mode 100644 index 000000000..5ec1d2215 --- /dev/null +++ b/Extras/Serialize/BulletFileLoader/autogenerated/bullet_btMatrix3x3DoubleData.h @@ -0,0 +1,40 @@ +/* Copyright (C) 2006-2009 Erwin Coumans & Charlie C +* +* This software is provided 'as-is', without any express or implied +* warranty. In no event will the authors be held liable for any damages +* arising from the use of this software. +* +* Permission is granted to anyone to use this software for any purpose, +* including commercial applications, and to alter it and redistribute it +* freely, subject to the following restrictions: +* +* 1. The origin of this software must not be misrepresented; you must not +* claim that you wrote the original software. If you use this software +* in a product, an acknowledgment in the product documentation would be +* appreciated but is not required. +* 2. Altered source versions must be plainly marked as such, and must not be +* misrepresented as being the original software. +* 3. This notice may not be removed or altered from any source distribution. +*/ +// Auto generated from makesdna dna.c +#ifndef __BULLET_BTMATRIX3X3DOUBLEDATA__H__ +#define __BULLET_BTMATRIX3X3DOUBLEDATA__H__ + + +// -------------------------------------------------- // +#include "bullet_Common.h" +#include "bullet_btVector3DoubleData.h" + +namespace Bullet { + + + // ---------------------------------------------- // + class btMatrix3x3DoubleData + { + public: + btVector3DoubleData m_el[3]; + }; +} + + +#endif//__BULLET_BTMATRIX3X3DOUBLEDATA__H__ diff --git a/Extras/Serialize/BulletFileLoader/autogenerated/bullet_btMatrix3x3FloatData.h b/Extras/Serialize/BulletFileLoader/autogenerated/bullet_btMatrix3x3FloatData.h new file mode 100644 index 000000000..5b4521b05 --- /dev/null +++ b/Extras/Serialize/BulletFileLoader/autogenerated/bullet_btMatrix3x3FloatData.h @@ -0,0 +1,40 @@ +/* Copyright (C) 2006-2009 Erwin Coumans & Charlie C +* +* This software is provided 'as-is', without any express or implied +* warranty. In no event will the authors be held liable for any damages +* arising from the use of this software. +* +* Permission is granted to anyone to use this software for any purpose, +* including commercial applications, and to alter it and redistribute it +* freely, subject to the following restrictions: +* +* 1. The origin of this software must not be misrepresented; you must not +* claim that you wrote the original software. If you use this software +* in a product, an acknowledgment in the product documentation would be +* appreciated but is not required. +* 2. Altered source versions must be plainly marked as such, and must not be +* misrepresented as being the original software. +* 3. This notice may not be removed or altered from any source distribution. +*/ +// Auto generated from makesdna dna.c +#ifndef __BULLET_BTMATRIX3X3FLOATDATA__H__ +#define __BULLET_BTMATRIX3X3FLOATDATA__H__ + + +// -------------------------------------------------- // +#include "bullet_Common.h" +#include "bullet_btVector3FloatData.h" + +namespace Bullet { + + + // ---------------------------------------------- // + class btMatrix3x3FloatData + { + public: + btVector3FloatData m_el[3]; + }; +} + + +#endif//__BULLET_BTMATRIX3X3FLOATDATA__H__ diff --git a/Extras/Serialize/BulletFileLoader/autogenerated/bullet_btPositionAndRadius.h b/Extras/Serialize/BulletFileLoader/autogenerated/bullet_btPositionAndRadius.h index ad3703d93..e65656e0f 100644 --- a/Extras/Serialize/BulletFileLoader/autogenerated/bullet_btPositionAndRadius.h +++ b/Extras/Serialize/BulletFileLoader/autogenerated/bullet_btPositionAndRadius.h @@ -23,7 +23,7 @@ // -------------------------------------------------- // #include "bullet_Common.h" -#include "bullet_btVector3Data.h" +#include "bullet_btVector3FloatData.h" namespace Bullet { @@ -32,8 +32,8 @@ namespace Bullet { class btPositionAndRadius { public: - btVector3Data m_pos; - btScalar m_radius; + btVector3FloatData m_pos; + float m_radius; }; } diff --git a/Extras/Serialize/BulletFileLoader/autogenerated/bullet_btRigidBodyDoubleData.h b/Extras/Serialize/BulletFileLoader/autogenerated/bullet_btRigidBodyDoubleData.h new file mode 100644 index 000000000..8f578b6fd --- /dev/null +++ b/Extras/Serialize/BulletFileLoader/autogenerated/bullet_btRigidBodyDoubleData.h @@ -0,0 +1,63 @@ +/* Copyright (C) 2006-2009 Erwin Coumans & Charlie C +* +* This software is provided 'as-is', without any express or implied +* warranty. In no event will the authors be held liable for any damages +* arising from the use of this software. +* +* Permission is granted to anyone to use this software for any purpose, +* including commercial applications, and to alter it and redistribute it +* freely, subject to the following restrictions: +* +* 1. The origin of this software must not be misrepresented; you must not +* claim that you wrote the original software. If you use this software +* in a product, an acknowledgment in the product documentation would be +* appreciated but is not required. +* 2. Altered source versions must be plainly marked as such, and must not be +* misrepresented as being the original software. +* 3. This notice may not be removed or altered from any source distribution. +*/ +// Auto generated from makesdna dna.c +#ifndef __BULLET_BTRIGIDBODYDOUBLEDATA__H__ +#define __BULLET_BTRIGIDBODYDOUBLEDATA__H__ + + +// -------------------------------------------------- // +#include "bullet_Common.h" +#include "bullet_btCollisionObjectDoubleData.h" +#include "bullet_btMatrix3x3DoubleData.h" +#include "bullet_btVector3DoubleData.h" + +namespace Bullet { + + + // ---------------------------------------------- // + class btRigidBodyDoubleData + { + public: + btCollisionObjectDoubleData m_collisionObjectData; + btMatrix3x3DoubleData m_invInertiaTensorWorld; + btVector3DoubleData m_linearVelocity; + btVector3DoubleData m_angularVelocity; + btVector3DoubleData m_angularFactor; + btVector3DoubleData m_linearFactor; + btVector3DoubleData m_gravity; + btVector3DoubleData m_gravity_acceleration; + btVector3DoubleData m_invInertiaLocal; + btVector3DoubleData m_totalForce; + btVector3DoubleData m_totalTorque; + double m_inverseMass; + double m_linearDamping; + double m_angularDamping; + double m_additionalDampingFactor; + double m_additionalLinearDampingThresholdSqr; + double m_additionalAngularDampingThresholdSqr; + double m_additionalAngularDampingFactor; + double m_linearSleepingThreshold; + double m_angularSleepingThreshold; + int m_additionalDamping; + char m_padding[4]; + }; +} + + +#endif//__BULLET_BTRIGIDBODYDOUBLEDATA__H__ diff --git a/Extras/Serialize/BulletFileLoader/autogenerated/bullet_btRigidBodyFloatData.h b/Extras/Serialize/BulletFileLoader/autogenerated/bullet_btRigidBodyFloatData.h new file mode 100644 index 000000000..9d8a936fe --- /dev/null +++ b/Extras/Serialize/BulletFileLoader/autogenerated/bullet_btRigidBodyFloatData.h @@ -0,0 +1,62 @@ +/* Copyright (C) 2006-2009 Erwin Coumans & Charlie C +* +* This software is provided 'as-is', without any express or implied +* warranty. In no event will the authors be held liable for any damages +* arising from the use of this software. +* +* Permission is granted to anyone to use this software for any purpose, +* including commercial applications, and to alter it and redistribute it +* freely, subject to the following restrictions: +* +* 1. The origin of this software must not be misrepresented; you must not +* claim that you wrote the original software. If you use this software +* in a product, an acknowledgment in the product documentation would be +* appreciated but is not required. +* 2. Altered source versions must be plainly marked as such, and must not be +* misrepresented as being the original software. +* 3. This notice may not be removed or altered from any source distribution. +*/ +// Auto generated from makesdna dna.c +#ifndef __BULLET_BTRIGIDBODYFLOATDATA__H__ +#define __BULLET_BTRIGIDBODYFLOATDATA__H__ + + +// -------------------------------------------------- // +#include "bullet_Common.h" +#include "bullet_btCollisionObjectFloatData.h" +#include "bullet_btMatrix3x3FloatData.h" +#include "bullet_btVector3FloatData.h" + +namespace Bullet { + + + // ---------------------------------------------- // + class btRigidBodyFloatData + { + public: + btCollisionObjectFloatData m_collisionObjectData; + btMatrix3x3FloatData m_invInertiaTensorWorld; + btVector3FloatData m_linearVelocity; + btVector3FloatData m_angularVelocity; + btVector3FloatData m_angularFactor; + btVector3FloatData m_linearFactor; + btVector3FloatData m_gravity; + btVector3FloatData m_gravity_acceleration; + btVector3FloatData m_invInertiaLocal; + btVector3FloatData m_totalForce; + btVector3FloatData m_totalTorque; + float m_inverseMass; + float m_linearDamping; + float m_angularDamping; + float m_additionalDampingFactor; + float m_additionalLinearDampingThresholdSqr; + float m_additionalAngularDampingThresholdSqr; + float m_additionalAngularDampingFactor; + float m_linearSleepingThreshold; + float m_angularSleepingThreshold; + int m_additionalDamping; + }; +} + + +#endif//__BULLET_BTRIGIDBODYFLOATDATA__H__ diff --git a/Extras/Serialize/BulletFileLoader/autogenerated/bullet_btStridingMeshInterfaceData.h b/Extras/Serialize/BulletFileLoader/autogenerated/bullet_btStridingMeshInterfaceData.h index 2341cead9..0ce2aec6d 100644 --- a/Extras/Serialize/BulletFileLoader/autogenerated/bullet_btStridingMeshInterfaceData.h +++ b/Extras/Serialize/BulletFileLoader/autogenerated/bullet_btStridingMeshInterfaceData.h @@ -23,7 +23,7 @@ // -------------------------------------------------- // #include "bullet_Common.h" -#include "bullet_btVector3Data.h" +#include "bullet_btVector3FloatData.h" namespace Bullet { @@ -33,8 +33,8 @@ namespace Bullet { { public: btMeshPartData *m_meshPartsPtr; + btVector3FloatData m_scaling; int m_numMeshParts; - btVector3Data m_scaling; char m_padding[4]; }; } diff --git a/Extras/Serialize/BulletFileLoader/autogenerated/bullet_btTransformDoubleData.h b/Extras/Serialize/BulletFileLoader/autogenerated/bullet_btTransformDoubleData.h new file mode 100644 index 000000000..11b8d4302 --- /dev/null +++ b/Extras/Serialize/BulletFileLoader/autogenerated/bullet_btTransformDoubleData.h @@ -0,0 +1,42 @@ +/* Copyright (C) 2006-2009 Erwin Coumans & Charlie C +* +* This software is provided 'as-is', without any express or implied +* warranty. In no event will the authors be held liable for any damages +* arising from the use of this software. +* +* Permission is granted to anyone to use this software for any purpose, +* including commercial applications, and to alter it and redistribute it +* freely, subject to the following restrictions: +* +* 1. The origin of this software must not be misrepresented; you must not +* claim that you wrote the original software. If you use this software +* in a product, an acknowledgment in the product documentation would be +* appreciated but is not required. +* 2. Altered source versions must be plainly marked as such, and must not be +* misrepresented as being the original software. +* 3. This notice may not be removed or altered from any source distribution. +*/ +// Auto generated from makesdna dna.c +#ifndef __BULLET_BTTRANSFORMDOUBLEDATA__H__ +#define __BULLET_BTTRANSFORMDOUBLEDATA__H__ + + +// -------------------------------------------------- // +#include "bullet_Common.h" +#include "bullet_btMatrix3x3DoubleData.h" +#include "bullet_btVector3DoubleData.h" + +namespace Bullet { + + + // ---------------------------------------------- // + class btTransformDoubleData + { + public: + btMatrix3x3DoubleData m_basis; + btVector3DoubleData m_origin; + }; +} + + +#endif//__BULLET_BTTRANSFORMDOUBLEDATA__H__ diff --git a/Extras/Serialize/BulletFileLoader/autogenerated/bullet_btTransformFloatData.h b/Extras/Serialize/BulletFileLoader/autogenerated/bullet_btTransformFloatData.h new file mode 100644 index 000000000..9d8f98a5d --- /dev/null +++ b/Extras/Serialize/BulletFileLoader/autogenerated/bullet_btTransformFloatData.h @@ -0,0 +1,42 @@ +/* Copyright (C) 2006-2009 Erwin Coumans & Charlie C +* +* This software is provided 'as-is', without any express or implied +* warranty. In no event will the authors be held liable for any damages +* arising from the use of this software. +* +* Permission is granted to anyone to use this software for any purpose, +* including commercial applications, and to alter it and redistribute it +* freely, subject to the following restrictions: +* +* 1. The origin of this software must not be misrepresented; you must not +* claim that you wrote the original software. If you use this software +* in a product, an acknowledgment in the product documentation would be +* appreciated but is not required. +* 2. Altered source versions must be plainly marked as such, and must not be +* misrepresented as being the original software. +* 3. This notice may not be removed or altered from any source distribution. +*/ +// Auto generated from makesdna dna.c +#ifndef __BULLET_BTTRANSFORMFLOATDATA__H__ +#define __BULLET_BTTRANSFORMFLOATDATA__H__ + + +// -------------------------------------------------- // +#include "bullet_Common.h" +#include "bullet_btMatrix3x3FloatData.h" +#include "bullet_btVector3FloatData.h" + +namespace Bullet { + + + // ---------------------------------------------- // + class btTransformFloatData + { + public: + btMatrix3x3FloatData m_basis; + btVector3FloatData m_origin; + }; +} + + +#endif//__BULLET_BTTRANSFORMFLOATDATA__H__ diff --git a/Extras/Serialize/BulletFileLoader/autogenerated/bullet_btTriangleMeshShapeData.h b/Extras/Serialize/BulletFileLoader/autogenerated/bullet_btTriangleMeshShapeData.h index c1a39f8a5..ce6c14add 100644 --- a/Extras/Serialize/BulletFileLoader/autogenerated/bullet_btTriangleMeshShapeData.h +++ b/Extras/Serialize/BulletFileLoader/autogenerated/bullet_btTriangleMeshShapeData.h @@ -23,6 +23,7 @@ // -------------------------------------------------- // #include "bullet_Common.h" +#include "bullet_btCollisionShapeData.h" #include "bullet_btStridingMeshInterfaceData.h" namespace Bullet { @@ -32,10 +33,10 @@ namespace Bullet { class btTriangleMeshShapeData { public: - bInvalidHandle btCollisionShapeData; - bInvalidHandle m_collisionShapeData; + btCollisionShapeData m_collisionShapeData; btStridingMeshInterfaceData m_meshInterface; - btScalar m_collisionMargin; + float m_collisionMargin; + char m_padding[4]; }; } diff --git a/Extras/Serialize/BulletFileLoader/bDNA.cpp b/Extras/Serialize/BulletFileLoader/bDNA.cpp index 47b7eca0d..6496f5821 100644 --- a/Extras/Serialize/BulletFileLoader/bDNA.cpp +++ b/Extras/Serialize/BulletFileLoader/bDNA.cpp @@ -187,6 +187,8 @@ void bDNA::initCmpFlags(bDNA *memDNA) mCMPFlags[i] = FDF_NONE; continue; } + //char* typeName = mTypes[oldStruct[0]]; + //#define SLOW_FORWARD_COMPATIBLE 1 #ifdef SLOW_FORWARD_COMPATIBLE char* typeName = mTypes[oldLookup]; @@ -227,6 +229,8 @@ void bDNA::initCmpFlags(bDNA *memDNA) for (int j=0; jmTypes[curStruct[0]])!=0) { isSame=false; diff --git a/Extras/Serialize/BulletFileLoader/bFile.cpp b/Extras/Serialize/BulletFileLoader/bFile.cpp index 06ea8c513..0b16573ef 100644 --- a/Extras/Serialize/BulletFileLoader/bFile.cpp +++ b/Extras/Serialize/BulletFileLoader/bFile.cpp @@ -109,20 +109,26 @@ void bFile::parseHeader() memcpy(header, blenderBuf, SIZEOFBLENDERHEADER); header[SIZEOFBLENDERHEADER]='\0'; - if (strncmp(header, m_headerString, 7)!=0) + if (strncmp(header, m_headerString, 6)!=0) { - printf ("Invalid blend file..."); + memcpy(header, m_headerString, SIZEOFBLENDERHEADER); + printf ("Invalid %s file...",header); return; } + if (header[6] == 'd') + { + mFlags |= FD_DOUBLE_PRECISION; + } + char *ver = header+9; mVersion = atoi(ver); if (mVersion <= 241) printf ("Warning, %d not fully tested : <= 242\n", mVersion); - int endian= 1; - endian= ((char*)&endian)[0]; + int littleEndian= 1; + littleEndian= ((char*)&littleEndian)[0]; // swap ptr sizes... if (header[7]=='-') @@ -134,10 +140,10 @@ void bFile::parseHeader() else if (VOID_IS_8) mFlags |= FD_BITS_VARIES; // swap endian... - if (header[8]=='V' && endian ==1) + if (header[8]=='V' && littleEndian ==1) mFlags |= FD_ENDIAN_SWAP; else - if (endian==0) + if (littleEndian==0) mFlags |= FD_ENDIAN_SWAP; @@ -383,12 +389,25 @@ void bFile::parseStruct(char *strcPtr, char *dtPtr, int old_dna, int new_dna, bo cpo = getFileElement(firstStruct, memName, memType, dtPtr, &filePtrOld); if (cpo) { + int arrayLen = mFileDNA->getArraySizeNew(filePtrOld[1]); old_nr = mFileDNA->getReverseType(memType); new_nr = revType; fpLen = mFileDNA->getElementSize(filePtrOld[0], filePtrOld[1]); + if (arrayLen==1) + { + parseStruct(cpc, cpo, old_nr, new_nr,fixupPointers); + } else + { + char* tmpCpc = cpc; + char* tmpCpo = cpo; - - parseStruct(cpc, cpo, old_nr, new_nr,fixupPointers); + for (int i=0;iinit((char*)sBulletDNAstr,sBulletDNAlen); +//#ifdef _WIN64 + if (VOID_IS_8) + mMemoryDNA->init((char*)sBulletDNAstr64,sBulletDNAlen64); + else +//#else + mMemoryDNA->init((char*)sBulletDNAstr,sBulletDNAlen); +//#endif } @@ -128,6 +136,9 @@ void btBulletFile::parseData() // { // m_glob = (bStructHandle*) id; // } + } else + { + printf("unknown chunk\n"); } // next please! @@ -158,17 +169,25 @@ void btBulletFile::writeDNA(FILE* fp) if (VOID_IS_8) { - //dataChunk.len = DNAlen64; - //dataChunk.oldPtr = DNAstr64; - //fwrite(&dataChunk,sizeof(bChunkInd),1,fp); - //fwrite(DNAstr64, DNAlen64,1,fp); +//#ifdef _WIN64 + dataChunk.len = sBulletDNAlen64; + dataChunk.oldPtr = sBulletDNAstr64; + fwrite(&dataChunk,sizeof(bChunkInd),1,fp); + fwrite(sBulletDNAstr64, sBulletDNAlen64,1,fp); +//#else +// btAssert(0); +//#endif } else { +//#ifndef _WIN64 dataChunk.len = sBulletDNAlen; dataChunk.oldPtr = sBulletDNAstr; fwrite(&dataChunk,sizeof(bChunkInd),1,fp); fwrite(sBulletDNAstr, sBulletDNAlen,1,fp); +//#else +// btAssert(0); +//#endif } } @@ -177,12 +196,19 @@ void btBulletFile::parse(bool verboseDumpAllTypes) { if (VOID_IS_8) { - exit(0); - //parseInternal(verboseDumpAllTypes,(char*)DNAstr64,DNAlen64); +//#ifdef _WIN64 + parseInternal(verboseDumpAllTypes,(char*)sBulletDNAstr64,sBulletDNAlen64); +//#else +// btAssert(0); +//#endif } else { +//#ifndef _WIN64 parseInternal(verboseDumpAllTypes,(char*)sBulletDNAstr,sBulletDNAlen); +//#else +// btAssert(0); +//#endif } } diff --git a/Extras/Serialize/BulletFileLoader/btBulletFileLoader.cpp b/Extras/Serialize/BulletFileLoader/btBulletFileLoader.cpp index 1fde7c434..95d8b6cf8 100644 --- a/Extras/Serialize/BulletFileLoader/btBulletFileLoader.cpp +++ b/Extras/Serialize/BulletFileLoader/btBulletFileLoader.cpp @@ -4,6 +4,7 @@ #include "btBulletDynamicsCommon.h" + btBulletFileLoader::btBulletFileLoader(btDynamicsWorld* world) :m_dynamicsWorld(world), m_verboseDumpAllTypes(false) @@ -12,7 +13,7 @@ m_verboseDumpAllTypes(false) bool btBulletFileLoader::loadFileFromMemory( char* fileName) { - bParse::btBulletFile* bulletFile2 = new bParse::btBulletFile("testFile.bullet"); + bParse::btBulletFile* bulletFile2 = new bParse::btBulletFile(fileName); bool result = loadFileFromMemory(bulletFile2); @@ -69,7 +70,7 @@ bool btBulletFileLoader::loadFileFromMemory( bParse::btBulletFile* bulletFile2) { btConvexInternalShapeData* bsd = (btConvexInternalShapeData*)shapeData; btVector3 implicitShapeDimensions; - implicitShapeDimensions.deSerialize(bsd->m_implicitShapeDimensions); + implicitShapeDimensions.deSerializeFloat(bsd->m_implicitShapeDimensions); btVector3 margin(bsd->m_collisionMargin,bsd->m_collisionMargin,bsd->m_collisionMargin); btCollisionShape* shape = 0; switch (shapeData->m_shapeType) @@ -107,7 +108,7 @@ bool btBulletFileLoader::loadFileFromMemory( bParse::btBulletFile* bulletFile2) tmpPos.resize(numSpheres); for (int i=0;im_localPositionArrayPtr[i].m_pos); + tmpPos[i].deSerializeFloat(mss->m_localPositionArrayPtr[i].m_pos); radii[i] = mss->m_localPositionArrayPtr[i].m_radius; } shape = new btMultiSphereShape(&tmpPos[0],&radii[0],numSpheres); @@ -115,6 +116,9 @@ bool btBulletFileLoader::loadFileFromMemory( bParse::btBulletFile* bulletFile2) } case CONVEX_HULL_SHAPE_PROXYTYPE: { + int sz = sizeof(btConvexHullShapeData); + int sz2 = sizeof(btConvexInternalShapeData); + int sz3 = sizeof(btCollisionShapeData); btConvexHullShapeData* convexData = (btConvexHullShapeData*)bsd; int numPoints = convexData->m_numUnscaledPoints; @@ -122,7 +126,17 @@ bool btBulletFileLoader::loadFileFromMemory( bParse::btBulletFile* bulletFile2) tmpPoints.resize(numPoints); for (int i=0;im_unscaledPointsPtr[i]); +#ifdef BT_USE_DOUBLE_PRECISION + if (convexData->m_unscaledPointsDoublePtr) + tmpPoints[i].deSerialize(convexData->m_unscaledPointsDoublePtr[i]); + if (convexData->m_unscaledPointsFloatPtr) + tmpPoints[i].deSerializeFloat(convexData->m_unscaledPointsFloatPtr[i]); +#else + if (convexData->m_unscaledPointsFloatPtr) + tmpPoints[i].deSerialize(convexData->m_unscaledPointsFloatPtr[i]); + if (convexData->m_unscaledPointsDoublePtr) + tmpPoints[i].deSerializeDouble(convexData->m_unscaledPointsDoublePtr[i]); +#endif //BT_USE_DOUBLE_PRECISION } shape = new btConvexHullShape(&tmpPoints[0].getX(),numPoints,sizeof(btVector3)); break; @@ -137,7 +151,7 @@ bool btBulletFileLoader::loadFileFromMemory( bParse::btBulletFile* bulletFile2) { shape->setMargin(bsd->m_collisionMargin); btVector3 localScaling; - localScaling.deSerialize(bsd->m_localScaling); + localScaling.deSerializeFloat(bsd->m_localScaling); shape->setLocalScaling(localScaling); shapeMap.insert(shapeData,shape); @@ -179,7 +193,7 @@ bool btBulletFileLoader::loadFileFromMemory( bParse::btBulletFile* bulletFile2) meshInterface->addIndexedMesh(meshPart); } - btVector3 scaling; scaling.deSerialize(trimesh->m_meshInterface.m_scaling); + btVector3 scaling; scaling.deSerializeFloat(trimesh->m_meshInterface.m_scaling); meshInterface->setScaling(scaling); btBvhTriangleMeshShape* trimeshShape = new btBvhTriangleMeshShape(meshInterface,true); @@ -198,29 +212,53 @@ bool btBulletFileLoader::loadFileFromMemory( bParse::btBulletFile* bulletFile2) } for (i=0;im_rigidBodies.size();i++) { - btRigidBodyData* colObjData = (btRigidBodyData*)bulletFile2->m_rigidBodies[i]; - btScalar mass = colObjData->m_inverseMass? 1.f/colObjData->m_inverseMass : 0.f; - btVector3 localInertia; - localInertia.setZero(); - btCollisionShape** shapePtr = shapeMap.find(colObjData->m_collisionObjectData.m_collisionShape); - if (shapePtr && *shapePtr) + if (bulletFile2->getFlags() & bParse::FD_DOUBLE_PRECISION) { - btTransform startTransform; - startTransform.deSerialize(colObjData->m_collisionObjectData.m_worldTransform); - - btCollisionShape* shape = (btCollisionShape*)*shapePtr; - - if (mass) + btRigidBodyDoubleData* colObjData = (btRigidBodyDoubleData*)bulletFile2->m_rigidBodies[i]; + btScalar mass = btScalar(colObjData->m_inverseMass? 1.f/colObjData->m_inverseMass : 0.f); + btVector3 localInertia; + localInertia.setZero(); + btCollisionShape** shapePtr = shapeMap.find(colObjData->m_collisionObjectData.m_collisionShape); + if (shapePtr && *shapePtr) { - shape->calculateLocalInertia(mass,localInertia); + btTransform startTransform; + startTransform.deSerializeDouble(colObjData->m_collisionObjectData.m_worldTransform); + // startTransform.setBasis(btMatrix3x3::getIdentity()); + btCollisionShape* shape = (btCollisionShape*)*shapePtr; + if (mass) + { + shape->calculateLocalInertia(mass,localInertia); + } + bool isDynamic = mass!=0.f; + createRigidBody(isDynamic,mass,startTransform,shape); + } else + { + printf("error: no shape found\n"); } - - bool isDynamic = mass!=0.f; - createRigidBody(isDynamic,mass,startTransform,shape); - + } else { - printf("error: no shape found\n"); + btRigidBodyFloatData* colObjData = (btRigidBodyFloatData*)bulletFile2->m_rigidBodies[i]; + btScalar mass = btScalar(colObjData->m_inverseMass? 1.f/colObjData->m_inverseMass : 0.f); + btVector3 localInertia; + localInertia.setZero(); + btCollisionShape** shapePtr = shapeMap.find(colObjData->m_collisionObjectData.m_collisionShape); + if (shapePtr && *shapePtr) + { + btTransform startTransform; + startTransform.deSerializeFloat(colObjData->m_collisionObjectData.m_worldTransform); + // startTransform.setBasis(btMatrix3x3::getIdentity()); + btCollisionShape* shape = (btCollisionShape*)*shapePtr; + if (mass) + { + shape->calculateLocalInertia(mass,localInertia); + } + bool isDynamic = mass!=0.f; + createRigidBody(isDynamic,mass,startTransform,shape); + } else + { + printf("error: no shape found\n"); + } } } @@ -244,7 +282,7 @@ btTypedConstraint* btBulletFileLoader::createUniversalD6Constraint(class btRig return 0; } -btRigidBody* btBulletFileLoader::createRigidBody(bool isDynamic, float mass, const btTransform& startTransform,btCollisionShape* shape) +btRigidBody* btBulletFileLoader::createRigidBody(bool isDynamic, btScalar mass, const btTransform& startTransform,btCollisionShape* shape) { btVector3 localInertia; diff --git a/Extras/Serialize/BulletFileLoader/btBulletFileLoader.h b/Extras/Serialize/BulletFileLoader/btBulletFileLoader.h index 5afd51640..a6e31793e 100644 --- a/Extras/Serialize/BulletFileLoader/btBulletFileLoader.h +++ b/Extras/Serialize/BulletFileLoader/btBulletFileLoader.h @@ -75,7 +75,7 @@ public: ); virtual btRigidBody* createRigidBody(bool isDynamic, - float mass, + btScalar mass, const btTransform& startTransform, btCollisionShape* shape); diff --git a/Extras/Serialize/makesdna/makesdna.cpp b/Extras/Serialize/makesdna/makesdna.cpp index f22a546b2..77763627f 100644 --- a/Extras/Serialize/makesdna/makesdna.cpp +++ b/Extras/Serialize/makesdna/makesdna.cpp @@ -810,6 +810,7 @@ static int calculate_structlens(int firststruct) // has_pointer is set or alphalen != len if (has_pointer || alphalen != len) { if (alphalen % 8) { + printf("alphalen = %d len = %d\n",alphalen,len); printf("Sizeerror 8 in struct: %s (add %d bytes)\n", types[structtype], alphalen%8); dna_error = 1; } @@ -945,7 +946,6 @@ int make_structDNA(char *baseDirectory, FILE *file) add_type("float", 4); /* 7 */ add_type("double", 8); /* 8 */ add_type("void", 0); /* 9 */ - add_type("btScalar", 4); /* 10 */ /* 4 bytes in single precision, 8 in double precision */ // the defines above shouldn't be output in the padding file... firststruct = nr_types; @@ -1175,7 +1175,14 @@ int main(int argc, char ** argv) strcpy(baseDirectory, BASE_HEADER); } - fprintf (file, "unsigned char sBulletDNAstr[]= {\n"); + if (sizeof(void*)==8) + { + fprintf (file, "unsigned char sBulletDNAstr64[]= {\n"); + } else + { + fprintf (file, "unsigned char sBulletDNAstr[]= {\n"); + } + if (make_structDNA(baseDirectory, file)) { // error fclose(file); @@ -1183,7 +1190,13 @@ int main(int argc, char ** argv) return_status = 1; } else { fprintf(file, "};\n"); - fprintf(file, "int sBulletDNAlen= sizeof(sBulletDNAstr);\n"); + if (sizeof(void*)==8) + { + fprintf(file, "int sBulletDNAlen64= sizeof(sBulletDNAstr64);\n"); + } else + { + fprintf(file, "int sBulletDNAlen= sizeof(sBulletDNAstr);\n"); + } fclose(file); } diff --git a/src/BulletCollision/CollisionDispatch/btCollisionObject.h b/src/BulletCollision/CollisionDispatch/btCollisionObject.h index 83198606d..569a786c6 100644 --- a/src/BulletCollision/CollisionDispatch/btCollisionObject.h +++ b/src/BulletCollision/CollisionDispatch/btCollisionObject.h @@ -34,6 +34,14 @@ struct btCollisionShapeData; typedef btAlignedObjectArray btCollisionObjectArray; +#ifdef BT_USE_DOUBLE_PRECISION +#define btCollisionObjectData btCollisionObjectDoubleData +#define btCollisionObjectDataName "btCollisionObjectDoubleData" +#else +#define btCollisionObjectData btCollisionObjectFloatData +#define btCollisionObjectDataName "btCollisionObjectFloatData" +#endif + /// btCollisionObject can be used to manage collision detection objects. /// btCollisionObject maintains all information that is needed for a collision detection: Shape, Transform and AABB proxy. @@ -427,34 +435,67 @@ public: ///using offsetof for m_vtablePadding might break some compilers, in that case define m_vtablePadding manually ///for serialization -struct btCollisionObjectData +struct btCollisionObjectDoubleData { - btTransformData m_worldTransform; - btTransformData m_interpolationWorldTransform; - btVector3Data m_interpolationLinearVelocity; - btVector3Data m_interpolationAngularVelocity; - btVector3Data m_anisotropicFriction; - int m_hasAnisotropicFriction; - btScalar m_contactProcessingThreshold; void *m_broadphaseHandle; void *m_collisionShape; btCollisionShapeData *m_rootCollisionShape; + void *m_userObjectPointer; + + btTransformDoubleData m_worldTransform; + btTransformDoubleData m_interpolationWorldTransform; + btVector3DoubleData m_interpolationLinearVelocity; + btVector3DoubleData m_interpolationAngularVelocity; + btVector3DoubleData m_anisotropicFriction; + double m_contactProcessingThreshold; + double m_deactivationTime; + double m_friction; + double m_restitution; + double m_hitFraction; + double m_ccdSweptSphereRadius; + double m_ccdMotionThreshold; + + int m_hasAnisotropicFriction; int m_collisionFlags; int m_islandTag1; int m_companionId; int m_activationState1; - btScalar m_deactivationTime; - btScalar m_friction; - btScalar m_restitution; int m_internalType; + int m_checkCollideWith; + char m_padding[4]; +}; + +struct btCollisionObjectFloatData +{ + void *m_broadphaseHandle; + void *m_collisionShape; + btCollisionShapeData *m_rootCollisionShape; void *m_userObjectPointer; - btScalar m_hitFraction; - btScalar m_ccdSweptSphereRadius; - btScalar m_ccdMotionThreshold; + + btTransformFloatData m_worldTransform; + btTransformFloatData m_interpolationWorldTransform; + btVector3FloatData m_interpolationLinearVelocity; + btVector3FloatData m_interpolationAngularVelocity; + btVector3FloatData m_anisotropicFriction; + float m_contactProcessingThreshold; + float m_deactivationTime; + float m_friction; + float m_restitution; + float m_hitFraction; + float m_ccdSweptSphereRadius; + float m_ccdMotionThreshold; + + int m_hasAnisotropicFriction; + int m_collisionFlags; + int m_islandTag1; + int m_companionId; + int m_activationState1; + int m_internalType; int m_checkCollideWith; }; + SIMD_FORCE_INLINE int btCollisionObject::calculateSerializeBufferSize() const { return sizeof(btCollisionObjectData); @@ -491,7 +532,7 @@ SIMD_FORCE_INLINE const char* btCollisionObject::serialize(void* dataBuffer) con dataOut->m_ccdMotionThreshold = m_ccdMotionThreshold; dataOut->m_checkCollideWith = m_checkCollideWith; - return "btCollisionObjectData"; + return btCollisionObjectDataName; } diff --git a/src/BulletCollision/CollisionShapes/btConvexHullShape.cpp b/src/BulletCollision/CollisionShapes/btConvexHullShape.cpp index 01281f74e..9a93c0a78 100644 --- a/src/BulletCollision/CollisionShapes/btConvexHullShape.cpp +++ b/src/BulletCollision/CollisionShapes/btConvexHullShape.cpp @@ -189,22 +189,32 @@ bool btConvexHullShape::isInside(const btVector3& ,btScalar ) const ///fills the dataBuffer and returns the struct name (and 0 on failure) const char* btConvexHullShape::serialize(void* dataBuffer, btSerializer* serializer) const { + int szc = sizeof(btConvexHullShapeData); btConvexHullShapeData* shapeData = (btConvexHullShapeData*) dataBuffer; btConvexInternalShape::serialize(&shapeData->m_convexInternalShapeData, serializer); int numElem = m_unscaledPoints.size(); shapeData->m_numUnscaledPoints = numElem; - shapeData->m_unscaledPointsPtr = numElem ? (btVector3Data*)&m_unscaledPoints[0]: 0; +#ifdef BT_USE_DOUBLE_PRECISION + shapeData->m_unscaledPointsFloatPtr = 0; + shapeData->m_unscaledPointsDoublePtr = numElem ? (btVector3Data*)&m_unscaledPoints[0]: 0; +#else + shapeData->m_unscaledPointsFloatPtr = numElem ? (btVector3Data*)&m_unscaledPoints[0]: 0; + shapeData->m_unscaledPointsDoublePtr = 0; +#endif if (numElem) { - btChunk* chunk = serializer->allocate(sizeof(btVector3Data),numElem); + int sz = sizeof(btVector3Data); + int sz2 = sizeof(btVector3DoubleData); + int sz3 = sizeof(btVector3FloatData); + btChunk* chunk = serializer->allocate(sz,numElem); btVector3Data* memPtr = (btVector3Data*)chunk->m_oldPtr; for (int i=0;ifinalizeChunk(chunk,"btVector3Data",BT_ARRAY_CODE,(void*)&m_unscaledPoints[0]); + serializer->finalizeChunk(chunk,btVector3DataName,BT_ARRAY_CODE,(void*)&m_unscaledPoints[0]); } return "btConvexHullShapeData"; diff --git a/src/BulletCollision/CollisionShapes/btConvexHullShape.h b/src/BulletCollision/CollisionShapes/btConvexHullShape.h index 68f04a7e0..dcdbbf40c 100644 --- a/src/BulletCollision/CollisionShapes/btConvexHullShape.h +++ b/src/BulletCollision/CollisionShapes/btConvexHullShape.h @@ -101,12 +101,15 @@ struct btConvexHullShapeData { btConvexInternalShapeData m_convexInternalShapeData; - btVector3Data *m_unscaledPointsPtr; + btVector3FloatData *m_unscaledPointsFloatPtr; + btVector3DoubleData *m_unscaledPointsDoublePtr; + int m_numUnscaledPoints; - char m_padding[4]; + char m_padding3[4]; }; + SIMD_FORCE_INLINE int btConvexHullShape::calculateSerializeBufferSize() { return sizeof(btConvexHullShapeData); diff --git a/src/BulletCollision/CollisionShapes/btConvexInternalShape.h b/src/BulletCollision/CollisionShapes/btConvexInternalShape.h index fc99740c4..8e187c6f9 100644 --- a/src/BulletCollision/CollisionShapes/btConvexInternalShape.h +++ b/src/BulletCollision/CollisionShapes/btConvexInternalShape.h @@ -19,6 +19,7 @@ subject to the following restrictions: #include "btConvexShape.h" #include "LinearMath/btAabbUtil2.h" + ///The btConvexInternalShape is an internal base class, shared by most convex shape implementations. class btConvexInternalShape : public btConvexShape { @@ -118,19 +119,17 @@ public: }; - - struct btConvexInternalShapeData { btCollisionShapeData m_collisionShapeData; - btVector3Data m_localScaling; + btVector3FloatData m_localScaling; - btVector3Data m_implicitShapeDimensions; + btVector3FloatData m_implicitShapeDimensions; - btScalar m_collisionMargin; + float m_collisionMargin; - char m_padding[4]; + int m_padding; }; @@ -147,9 +146,9 @@ SIMD_FORCE_INLINE const char* btConvexInternalShape::serialize(void* dataBuffer, btConvexInternalShapeData* shapeData = (btConvexInternalShapeData*) dataBuffer; btCollisionShape::serialize(&shapeData->m_collisionShapeData, serializer); - m_implicitShapeDimensions.serialize(shapeData->m_implicitShapeDimensions); - m_localScaling.serialize(shapeData->m_localScaling); - shapeData->m_collisionMargin = m_collisionMargin; + m_implicitShapeDimensions.serializeFloat(shapeData->m_implicitShapeDimensions); + m_localScaling.serializeFloat(shapeData->m_localScaling); + shapeData->m_collisionMargin = float(m_collisionMargin); return "btConvexInternalShapeData"; } diff --git a/src/BulletCollision/CollisionShapes/btMultiSphereShape.cpp b/src/BulletCollision/CollisionShapes/btMultiSphereShape.cpp index 5c83faea2..892e17433 100644 --- a/src/BulletCollision/CollisionShapes/btMultiSphereShape.cpp +++ b/src/BulletCollision/CollisionShapes/btMultiSphereShape.cpp @@ -155,8 +155,8 @@ const char* btMultiSphereShape::serialize(void* dataBuffer, btSerializer* serial btPositionAndRadius* memPtr = (btPositionAndRadius*)chunk->m_oldPtr; for (int i=0;im_pos); - memPtr->m_radius = m_radiArray[i]; + m_localPositionArray[i].serializeFloat(memPtr->m_pos); + memPtr->m_radius = float(m_radiArray[i]); } serializer->finalizeChunk(chunk,"btPositionAndRadius",BT_ARRAY_CODE,(void*)&m_localPositionArray[0]); } diff --git a/src/BulletCollision/CollisionShapes/btMultiSphereShape.h b/src/BulletCollision/CollisionShapes/btMultiSphereShape.h index bfad948c5..afc92ce86 100644 --- a/src/BulletCollision/CollisionShapes/btMultiSphereShape.h +++ b/src/BulletCollision/CollisionShapes/btMultiSphereShape.h @@ -21,6 +21,8 @@ subject to the following restrictions: #include "LinearMath/btAlignedObjectArray.h" #include "LinearMath/btAabbUtil2.h" + + ///The btMultiSphereShape represents the convex hull of a collection of spheres. You can create special capsules or other smooth volumes. ///It is possible to animate the spheres for deformation, but call 'recalcLocalAabb' after changing any sphere position/radius class btMultiSphereShape : public btConvexInternalAabbCachingShape @@ -69,10 +71,11 @@ public: }; + struct btPositionAndRadius { - btVector3Data m_pos; - btScalar m_radius; + btVector3FloatData m_pos; + float m_radius; }; struct btMultiSphereShapeData @@ -82,9 +85,10 @@ struct btMultiSphereShapeData btPositionAndRadius *m_localPositionArrayPtr; int m_localPositionArraySize; char m_padding[4]; - }; + + SIMD_FORCE_INLINE int btMultiSphereShape::calculateSerializeBufferSize() { return sizeof(btMultiSphereShapeData); diff --git a/src/BulletCollision/CollisionShapes/btStridingMeshInterface.cpp b/src/BulletCollision/CollisionShapes/btStridingMeshInterface.cpp index 9f7295f14..9a012e68c 100644 --- a/src/BulletCollision/CollisionShapes/btStridingMeshInterface.cpp +++ b/src/BulletCollision/CollisionShapes/btStridingMeshInterface.cpp @@ -327,6 +327,6 @@ const char* btStridingMeshInterface::serialize(void* dataBuffer, btSerializer* s } - m_scaling.serialize(trimeshData->m_scaling); + m_scaling.serializeFloat(trimeshData->m_scaling); return "btStridingMeshInterfaceData"; } diff --git a/src/BulletCollision/CollisionShapes/btStridingMeshInterface.h b/src/BulletCollision/CollisionShapes/btStridingMeshInterface.h index 4ae08b748..5b9741cce 100644 --- a/src/BulletCollision/CollisionShapes/btStridingMeshInterface.h +++ b/src/BulletCollision/CollisionShapes/btStridingMeshInterface.h @@ -22,6 +22,8 @@ subject to the following restrictions: + + /// The btStridingMeshInterface is the interface class for high performance generic access to triangle meshes, used in combination with btBvhTriangleMeshShape and some other collision shapes. /// Using index striding of 3*sizeof(integer) it can use triangle arrays, using index striding of 1*sizeof(integer) it can handle triangle strips. /// It allows for sharing graphics and collision meshes. Also it provides locking/unlocking of graphics meshes that are in gpu memory. @@ -118,19 +120,18 @@ struct btMeshPartData int m_numVertices; }; + struct btStridingMeshInterfaceData { btMeshPartData *m_meshPartsPtr; - + btVector3FloatData m_scaling; int m_numMeshParts; - - btVector3Data m_scaling; - char m_padding[4]; - }; + + SIMD_FORCE_INLINE int btStridingMeshInterface::calculateSerializeBufferSize() { return sizeof(btStridingMeshInterfaceData); diff --git a/src/BulletCollision/CollisionShapes/btTriangleMeshShape.cpp b/src/BulletCollision/CollisionShapes/btTriangleMeshShape.cpp index 892f85afb..24df7481d 100644 --- a/src/BulletCollision/CollisionShapes/btTriangleMeshShape.cpp +++ b/src/BulletCollision/CollisionShapes/btTriangleMeshShape.cpp @@ -218,7 +218,7 @@ const char* btTriangleMeshShape::serialize(void* dataBuffer, btSerializer* seria m_meshInterface->serialize(&trimeshData->m_meshInterface, serializer); - trimeshData->m_collisionMargin = m_collisionMargin; + trimeshData->m_collisionMargin = float(m_collisionMargin); return "btTriangleMeshShapeData"; } diff --git a/src/BulletCollision/CollisionShapes/btTriangleMeshShape.h b/src/BulletCollision/CollisionShapes/btTriangleMeshShape.h index cd81057fa..f74915431 100644 --- a/src/BulletCollision/CollisionShapes/btTriangleMeshShape.h +++ b/src/BulletCollision/CollisionShapes/btTriangleMeshShape.h @@ -20,6 +20,7 @@ subject to the following restrictions: #include "btStridingMeshInterface.h" + ///The btTriangleMeshShape is an internal concave triangle mesh interface. Don't use this class directly, use btBvhTriangleMeshShape instead. class btTriangleMeshShape : public btConcaveShape { @@ -90,14 +91,16 @@ public: struct btTriangleMeshShapeData { - //btConcaveShapeData m_concaveShapeData; btCollisionShapeData m_collisionShapeData; btStridingMeshInterfaceData m_meshInterface; - btScalar m_collisionMargin; + float m_collisionMargin; + + char m_padding[4]; }; + SIMD_FORCE_INLINE int btTriangleMeshShape::calculateSerializeBufferSize() { return sizeof(btTriangleMeshShapeData); diff --git a/src/BulletDynamics/Character/btKinematicCharacterController.h b/src/BulletDynamics/Character/btKinematicCharacterController.h index 4fc56c056..10e32754d 100644 --- a/src/BulletDynamics/Character/btKinematicCharacterController.h +++ b/src/BulletDynamics/Character/btKinematicCharacterController.h @@ -67,7 +67,7 @@ protected: bool m_useGhostObjectSweepTest; bool m_useWalkDirection; - float m_velocityTimeInterval; + btScalar m_velocityTimeInterval; int m_upAxis; btVector3 computeReflectionDirection (const btVector3& direction, const btVector3& normal); diff --git a/src/BulletDynamics/Dynamics/btRigidBody.cpp b/src/BulletDynamics/Dynamics/btRigidBody.cpp index e73ac17f9..48c037e50 100644 --- a/src/BulletDynamics/Dynamics/btRigidBody.cpp +++ b/src/BulletDynamics/Dynamics/btRigidBody.cpp @@ -350,6 +350,6 @@ const char* btRigidBody::serialize(void* dataBuffer) const rbd->m_linearSleepingThreshold=m_linearSleepingThreshold; rbd->m_angularSleepingThreshold = m_angularSleepingThreshold; - return "btRigidBodyData"; + return btRigidBodyDataName; } diff --git a/src/BulletDynamics/Dynamics/btRigidBody.h b/src/BulletDynamics/Dynamics/btRigidBody.h index 7028a9bcf..a807ef315 100644 --- a/src/BulletDynamics/Dynamics/btRigidBody.h +++ b/src/BulletDynamics/Dynamics/btRigidBody.h @@ -29,6 +29,16 @@ class btTypedConstraint; extern btScalar gDeactivationTime; extern bool gDisableDeactivation; +#ifdef BT_USE_DOUBLE_PRECISION +#define btRigidBodyData btRigidBodyDoubleData +#define btRigidBodyDataName "btRigidBodyDoubleData" +#else +#define btRigidBodyData btRigidBodyFloatData +#define btRigidBodyDataName "btRigidBodyFloatData" +#endif //BT_USE_DOUBLE_PRECISION + + + ///The btRigidBody is the main class for rigid body objects. It is derived from btCollisionObject, so it keeps a pointer to a btCollisionShape. ///It is recommended for performance and memory use to share btCollisionShape objects whenever possible. @@ -504,36 +514,55 @@ public: //@todo add m_optionalMotionState and m_constraintRefs to btRigidBodyData ///btRigidBodyData is used for btRigidBody serialization -struct btRigidBodyData +struct btRigidBodyFloatData { - btCollisionObjectData m_collisionObjectData; + btCollisionObjectFloatData m_collisionObjectData; + btMatrix3x3FloatData m_invInertiaTensorWorld; + btVector3FloatData m_linearVelocity; + btVector3FloatData m_angularVelocity; + btVector3FloatData m_angularFactor; + btVector3FloatData m_linearFactor; + btVector3FloatData m_gravity; + btVector3FloatData m_gravity_acceleration; + btVector3FloatData m_invInertiaLocal; + btVector3FloatData m_totalForce; + btVector3FloatData m_totalTorque; + float m_inverseMass; + float m_linearDamping; + float m_angularDamping; + float m_additionalDampingFactor; + float m_additionalLinearDampingThresholdSqr; + float m_additionalAngularDampingThresholdSqr; + float m_additionalAngularDampingFactor; + float m_linearSleepingThreshold; + float m_angularSleepingThreshold; + int m_additionalDamping; +}; - btMatrix3x3Data m_invInertiaTensorWorld; - btVector3Data m_linearVelocity; - btVector3Data m_angularVelocity; - btScalar m_inverseMass; - btVector3Data m_angularFactor; - btVector3Data m_linearFactor; - - btVector3Data m_gravity; - btVector3Data m_gravity_acceleration; - btVector3Data m_invInertiaLocal; - btVector3Data m_totalForce; - btVector3Data m_totalTorque; - - btScalar m_linearDamping; - btScalar m_angularDamping; - - int m_additionalDamping; - btScalar m_additionalDampingFactor; - btScalar m_additionalLinearDampingThresholdSqr; - btScalar m_additionalAngularDampingThresholdSqr; - btScalar m_additionalAngularDampingFactor; - - - btScalar m_linearSleepingThreshold; - btScalar m_angularSleepingThreshold; - +struct btRigidBodyDoubleData +{ + btCollisionObjectDoubleData m_collisionObjectData; + btMatrix3x3DoubleData m_invInertiaTensorWorld; + btVector3DoubleData m_linearVelocity; + btVector3DoubleData m_angularVelocity; + btVector3DoubleData m_angularFactor; + btVector3DoubleData m_linearFactor; + btVector3DoubleData m_gravity; + btVector3DoubleData m_gravity_acceleration; + btVector3DoubleData m_invInertiaLocal; + btVector3DoubleData m_totalForce; + btVector3DoubleData m_totalTorque; + double m_inverseMass; + double m_linearDamping; + double m_angularDamping; + double m_additionalDampingFactor; + double m_additionalLinearDampingThresholdSqr; + double m_additionalAngularDampingThresholdSqr; + double m_additionalAngularDampingFactor; + double m_linearSleepingThreshold; + double m_angularSleepingThreshold; + int m_additionalDamping; + char m_padding[4]; }; diff --git a/src/LinearMath/btConvexHull.cpp b/src/LinearMath/btConvexHull.cpp index c1138b797..8ff54288b 100644 --- a/src/LinearMath/btConvexHull.cpp +++ b/src/LinearMath/btConvexHull.cpp @@ -1011,9 +1011,9 @@ bool HullLibrary::CleanupVertices(unsigned int svcount, btScalar y = v[1]; btScalar z = v[2]; - btScalar dx = fabsf(x - px ); - btScalar dy = fabsf(y - py ); - btScalar dz = fabsf(z - pz ); + btScalar dx = btFabs(x - px ); + btScalar dy = btFabs(y - py ); + btScalar dz = btFabs(z - pz ); if ( dx < normalepsilon && dy < normalepsilon && dz < normalepsilon ) { diff --git a/src/LinearMath/btMatrix3x3.h b/src/LinearMath/btMatrix3x3.h index 9ee13f35d..1032e6a5a 100644 --- a/src/LinearMath/btMatrix3x3.h +++ b/src/LinearMath/btMatrix3x3.h @@ -19,6 +19,11 @@ subject to the following restrictions: #include "btVector3.h" #include "btQuaternion.h" +#ifdef BT_USE_DOUBLE_PRECISION +#define btMatrix3x3Data btMatrix3x3DoubleData +#else +#define btMatrix3x3Data btMatrix3x3FloatData +#endif //BT_USE_DOUBLE_PRECISION /**@brief The btMatrix3x3 class implements a 3x3 rotation matrix, to perform linear algebra in combination with btQuaternion, btTransform and btVector3. @@ -500,6 +505,10 @@ public: void deSerialize(const struct btMatrix3x3Data& dataIn); + void deSerializeFloat(const struct btMatrix3x3FloatData& dataIn); + + void deSerializeDouble(const struct btMatrix3x3DoubleData& dataIn); + }; @@ -628,11 +637,18 @@ SIMD_FORCE_INLINE bool operator==(const btMatrix3x3& m1, const btMatrix3x3& m2) } ///for serialization -struct btMatrix3x3Data +struct btMatrix3x3FloatData { - btVector3Data m_el[3]; + btVector3FloatData m_el[3]; }; +///for serialization +struct btMatrix3x3DoubleData +{ + btVector3DoubleData m_el[3]; +}; + + SIMD_FORCE_INLINE void btMatrix3x3::serialize(struct btMatrix3x3Data& dataOut) const { @@ -640,11 +656,24 @@ SIMD_FORCE_INLINE void btMatrix3x3::serialize(struct btMatrix3x3Data& dataOut) c m_el[i].serialize(dataOut.m_el[i]); } + SIMD_FORCE_INLINE void btMatrix3x3::deSerialize(const struct btMatrix3x3Data& dataIn) { for (int i=0;i<3;i++) m_el[i].deSerialize(dataIn.m_el[i]); } +SIMD_FORCE_INLINE void btMatrix3x3::deSerializeFloat(const struct btMatrix3x3FloatData& dataIn) +{ + for (int i=0;i<3;i++) + m_el[i].deSerializeFloat(dataIn.m_el[i]); +} + +SIMD_FORCE_INLINE void btMatrix3x3::deSerializeDouble(const struct btMatrix3x3DoubleData& dataIn) +{ + for (int i=0;i<3;i++) + m_el[i].deSerializeDouble(dataIn.m_el[i]); +} + #endif //BT_MATRIX3x3_H diff --git a/src/LinearMath/btSerializer.cpp b/src/LinearMath/btSerializer.cpp index 162cb3d15..6eb43a8c0 100644 --- a/src/LinearMath/btSerializer.cpp +++ b/src/LinearMath/btSerializer.cpp @@ -1,5 +1,6 @@ -unsigned char sBulletDNAstr[]= { -83,68,78,65,78,65,77,69,83,0,0,0,109,95,115,105,122,101,0,109, + +unsigned char sBulletDNAstr64[]= { +83,68,78,65,78,65,77,69,85,0,0,0,109,95,115,105,122,101,0,109, 95,99,97,112,97,99,105,116,121,0,42,109,95,100,97,116,97,0,109,95, 99,111,108,108,105,115,105,111,110,83,104,97,112,101,115,0,109,95,99,111, 108,108,105,115,105,111,110,79,98,106,101,99,116,115,0,109,95,99,111,110, @@ -12,115 +13,275 @@ unsigned char sBulletDNAstr[]= { 109,95,108,111,99,97,108,83,99,97,108,105,110,103,0,109,95,105,109,112, 108,105,99,105,116,83,104,97,112,101,68,105,109,101,110,115,105,111,110,115, 0,109,95,99,111,108,108,105,115,105,111,110,77,97,114,103,105,110,0,109, -95,112,111,115,0,109,95,114,97,100,105,117,115,0,109,95,99,111,110,118, -101,120,73,110,116,101,114,110,97,108,83,104,97,112,101,68,97,116,97,0, -42,109,95,108,111,99,97,108,80,111,115,105,116,105,111,110,65,114,114,97, -121,80,116,114,0,109,95,108,111,99,97,108,80,111,115,105,116,105,111,110, -65,114,114,97,121,83,105,122,101,0,109,95,118,97,108,117,101,0,105,110, -116,0,42,109,95,118,101,114,116,105,99,101,115,51,102,0,42,109,95,118, -101,114,116,105,99,101,115,51,100,0,42,109,95,105,110,100,105,99,101,115, -51,50,0,42,109,95,105,110,100,105,99,101,115,49,54,0,109,95,110,117, -109,84,114,105,97,110,103,108,101,115,0,109,95,110,117,109,86,101,114,116, -105,99,101,115,0,42,109,95,109,101,115,104,80,97,114,116,115,80,116,114, -0,109,95,110,117,109,77,101,115,104,80,97,114,116,115,0,109,95,115,99, -97,108,105,110,103,0,98,116,67,111,108,108,105,115,105,111,110,83,104,97, -112,101,68,97,116,97,0,109,95,109,101,115,104,73,110,116,101,114,102,97, -99,101,0,42,109,95,117,110,115,99,97,108,101,100,80,111,105,110,116,115, -80,116,114,0,109,95,110,117,109,85,110,115,99,97,108,101,100,80,111,105, -110,116,115,0,109,95,119,111,114,108,100,84,114,97,110,115,102,111,114,109, -0,109,95,105,110,116,101,114,112,111,108,97,116,105,111,110,87,111,114,108, -100,84,114,97,110,115,102,111,114,109,0,109,95,105,110,116,101,114,112,111, -108,97,116,105,111,110,76,105,110,101,97,114,86,101,108,111,99,105,116,121, -0,109,95,105,110,116,101,114,112,111,108,97,116,105,111,110,65,110,103,117, -108,97,114,86,101,108,111,99,105,116,121,0,109,95,97,110,105,115,111,116, -114,111,112,105,99,70,114,105,99,116,105,111,110,0,109,95,104,97,115,65, -110,105,115,111,116,114,111,112,105,99,70,114,105,99,116,105,111,110,0,109, -95,99,111,110,116,97,99,116,80,114,111,99,101,115,115,105,110,103,84,104, -114,101,115,104,111,108,100,0,42,109,95,98,114,111,97,100,112,104,97,115, -101,72,97,110,100,108,101,0,42,109,95,99,111,108,108,105,115,105,111,110, -83,104,97,112,101,0,42,109,95,114,111,111,116,67,111,108,108,105,115,105, -111,110,83,104,97,112,101,0,109,95,99,111,108,108,105,115,105,111,110,70, -108,97,103,115,0,109,95,105,115,108,97,110,100,84,97,103,49,0,109,95, -99,111,109,112,97,110,105,111,110,73,100,0,109,95,97,99,116,105,118,97, -116,105,111,110,83,116,97,116,101,49,0,109,95,100,101,97,99,116,105,118, -97,116,105,111,110,84,105,109,101,0,109,95,102,114,105,99,116,105,111,110, -0,109,95,114,101,115,116,105,116,117,116,105,111,110,0,109,95,105,110,116, -101,114,110,97,108,84,121,112,101,0,42,109,95,117,115,101,114,79,98,106, -101,99,116,80,111,105,110,116,101,114,0,109,95,104,105,116,70,114,97,99, -116,105,111,110,0,109,95,99,99,100,83,119,101,112,116,83,112,104,101,114, -101,82,97,100,105,117,115,0,109,95,99,99,100,77,111,116,105,111,110,84, -104,114,101,115,104,111,108,100,0,109,95,99,104,101,99,107,67,111,108,108, -105,100,101,87,105,116,104,0,109,95,99,111,108,108,105,115,105,111,110,79, -98,106,101,99,116,68,97,116,97,0,109,95,105,110,118,73,110,101,114,116, -105,97,84,101,110,115,111,114,87,111,114,108,100,0,109,95,108,105,110,101, -97,114,86,101,108,111,99,105,116,121,0,109,95,97,110,103,117,108,97,114, -86,101,108,111,99,105,116,121,0,109,95,105,110,118,101,114,115,101,77,97, -115,115,0,109,95,97,110,103,117,108,97,114,70,97,99,116,111,114,0,109, -95,108,105,110,101,97,114,70,97,99,116,111,114,0,109,95,103,114,97,118, -105,116,121,0,109,95,103,114,97,118,105,116,121,95,97,99,99,101,108,101, -114,97,116,105,111,110,0,109,95,105,110,118,73,110,101,114,116,105,97,76, -111,99,97,108,0,109,95,116,111,116,97,108,70,111,114,99,101,0,109,95, -116,111,116,97,108,84,111,114,113,117,101,0,109,95,108,105,110,101,97,114, -68,97,109,112,105,110,103,0,109,95,97,110,103,117,108,97,114,68,97,109, -112,105,110,103,0,109,95,97,100,100,105,116,105,111,110,97,108,68,97,109, -112,105,110,103,0,109,95,97,100,100,105,116,105,111,110,97,108,68,97,109, -112,105,110,103,70,97,99,116,111,114,0,109,95,97,100,100,105,116,105,111, -110,97,108,76,105,110,101,97,114,68,97,109,112,105,110,103,84,104,114,101, -115,104,111,108,100,83,113,114,0,109,95,97,100,100,105,116,105,111,110,97, -108,65,110,103,117,108,97,114,68,97,109,112,105,110,103,84,104,114,101,115, -104,111,108,100,83,113,114,0,109,95,97,100,100,105,116,105,111,110,97,108, -65,110,103,117,108,97,114,68,97,109,112,105,110,103,70,97,99,116,111,114, -0,109,95,108,105,110,101,97,114,83,108,101,101,112,105,110,103,84,104,114, -101,115,104,111,108,100,0,109,95,97,110,103,117,108,97,114,83,108,101,101, -112,105,110,103,84,104,114,101,115,104,111,108,100,0,0,0,84,89,80,69, -32,0,0,0,99,104,97,114,0,117,99,104,97,114,0,115,104,111,114,116, -0,117,115,104,111,114,116,0,105,110,116,0,108,111,110,103,0,117,108,111, -110,103,0,102,108,111,97,116,0,100,111,117,98,108,101,0,118,111,105,100, -0,98,116,83,99,97,108,97,114,0,80,111,105,110,116,101,114,65,114,114, -97,121,0,98,116,80,104,121,115,105,99,115,83,121,115,116,101,109,0,76, -105,115,116,66,97,115,101,0,98,116,86,101,99,116,111,114,51,68,97,116, -97,0,98,116,86,101,99,116,111,114,51,70,108,111,97,116,68,97,116,97, -0,98,116,86,101,99,116,111,114,51,68,111,117,98,108,101,68,97,116,97, -0,98,116,77,97,116,114,105,120,51,120,51,68,97,116,97,0,98,116,84, -114,97,110,115,102,111,114,109,68,97,116,97,0,98,116,67,111,108,108,105, -115,105,111,110,83,104,97,112,101,68,97,116,97,0,98,116,67,111,110,118, -101,120,73,110,116,101,114,110,97,108,83,104,97,112,101,68,97,116,97,0, -98,116,80,111,115,105,116,105,111,110,65,110,100,82,97,100,105,117,115,0, -98,116,77,117,108,116,105,83,112,104,101,114,101,83,104,97,112,101,68,97, -116,97,0,98,116,73,110,116,73,110,100,101,120,68,97,116,97,0,98,116, -83,104,111,114,116,73,110,116,73,110,100,101,120,68,97,116,97,0,98,116, -77,101,115,104,80,97,114,116,68,97,116,97,0,98,116,83,116,114,105,100, -105,110,103,77,101,115,104,73,110,116,101,114,102,97,99,101,68,97,116,97, -0,98,116,84,114,105,97,110,103,108,101,77,101,115,104,83,104,97,112,101, -68,97,116,97,0,109,95,99,111,110,99,97,118,101,83,104,97,112,101,68, -97,116,97,59,0,98,116,67,111,110,118,101,120,72,117,108,108,83,104,97, -112,101,68,97,116,97,0,98,116,67,111,108,108,105,115,105,111,110,79,98, -106,101,99,116,68,97,116,97,0,98,116,82,105,103,105,100,66,111,100,121, -68,97,116,97,0,0,0,0,84,76,69,78,1,0,1,0,2,0,2,0, -4,0,4,0,4,0,4,0,8,0,0,0,4,0,12,0,36,0,8,0, -16,0,16,0,32,0,48,0,64,0,12,0,52,0,20,0,64,0,4,0, -4,0,24,0,28,0,0,0,0,0,64,0,-8,0,-32,1,83,84,82,67, -20,0,0,0,11,0,3,0,4,0,0,0,4,0,1,0,9,0,2,0, -12,0,3,0,11,0,3,0,11,0,4,0,11,0,5,0,13,0,2,0, -9,0,6,0,9,0,7,0,14,0,1,0,10,0,8,0,15,0,1,0, -7,0,8,0,16,0,1,0,8,0,8,0,17,0,1,0,14,0,9,0, -18,0,2,0,17,0,10,0,14,0,11,0,19,0,3,0,9,0,12,0, -4,0,13,0,0,0,14,0,20,0,5,0,19,0,15,0,14,0,16,0, -14,0,17,0,10,0,18,0,0,0,14,0,21,0,2,0,14,0,19,0, -10,0,20,0,22,0,4,0,20,0,21,0,21,0,22,0,4,0,23,0, -0,0,14,0,23,0,1,0,4,0,24,0,24,0,2,0,2,0,25,0, -2,0,24,0,25,0,6,0,15,0,26,0,16,0,27,0,23,0,28,0, -24,0,29,0,4,0,30,0,4,0,31,0,26,0,4,0,25,0,32,0, -4,0,33,0,14,0,34,0,0,0,14,0,27,0,4,0,28,0,35,0, -28,0,15,0,26,0,36,0,10,0,18,0,29,0,4,0,20,0,21,0, -14,0,37,0,4,0,38,0,0,0,14,0,30,0,23,0,18,0,39,0, -18,0,40,0,14,0,41,0,14,0,42,0,14,0,43,0,4,0,44,0, -10,0,45,0,9,0,46,0,9,0,47,0,19,0,48,0,4,0,49,0, -4,0,50,0,4,0,51,0,4,0,52,0,10,0,53,0,10,0,54,0, -10,0,55,0,4,0,56,0,9,0,57,0,10,0,58,0,10,0,59,0, -10,0,60,0,4,0,61,0,31,0,21,0,30,0,62,0,17,0,63,0, -14,0,64,0,14,0,65,0,10,0,66,0,14,0,67,0,14,0,68,0, -14,0,69,0,14,0,70,0,14,0,71,0,14,0,72,0,14,0,73,0, -10,0,74,0,10,0,75,0,4,0,76,0,10,0,77,0,10,0,78,0, -10,0,79,0,10,0,80,0,10,0,81,0,10,0,82,0,}; +95,112,97,100,100,105,110,103,0,109,95,112,111,115,0,109,95,114,97,100, +105,117,115,0,109,95,99,111,110,118,101,120,73,110,116,101,114,110,97,108, +83,104,97,112,101,68,97,116,97,0,42,109,95,108,111,99,97,108,80,111, +115,105,116,105,111,110,65,114,114,97,121,80,116,114,0,109,95,108,111,99, +97,108,80,111,115,105,116,105,111,110,65,114,114,97,121,83,105,122,101,0, +109,95,118,97,108,117,101,0,105,110,116,0,42,109,95,118,101,114,116,105, +99,101,115,51,102,0,42,109,95,118,101,114,116,105,99,101,115,51,100,0, +42,109,95,105,110,100,105,99,101,115,51,50,0,42,109,95,105,110,100,105, +99,101,115,49,54,0,109,95,110,117,109,84,114,105,97,110,103,108,101,115, +0,109,95,110,117,109,86,101,114,116,105,99,101,115,0,42,109,95,109,101, +115,104,80,97,114,116,115,80,116,114,0,109,95,115,99,97,108,105,110,103, +0,109,95,110,117,109,77,101,115,104,80,97,114,116,115,0,109,95,109,101, +115,104,73,110,116,101,114,102,97,99,101,0,42,109,95,117,110,115,99,97, +108,101,100,80,111,105,110,116,115,70,108,111,97,116,80,116,114,0,42,109, +95,117,110,115,99,97,108,101,100,80,111,105,110,116,115,68,111,117,98,108, +101,80,116,114,0,109,95,110,117,109,85,110,115,99,97,108,101,100,80,111, +105,110,116,115,0,109,95,112,97,100,100,105,110,103,51,91,52,93,0,42, +109,95,98,114,111,97,100,112,104,97,115,101,72,97,110,100,108,101,0,42, +109,95,99,111,108,108,105,115,105,111,110,83,104,97,112,101,0,42,109,95, +114,111,111,116,67,111,108,108,105,115,105,111,110,83,104,97,112,101,0,42, +109,95,117,115,101,114,79,98,106,101,99,116,80,111,105,110,116,101,114,0, +109,95,119,111,114,108,100,84,114,97,110,115,102,111,114,109,0,109,95,105, +110,116,101,114,112,111,108,97,116,105,111,110,87,111,114,108,100,84,114,97, +110,115,102,111,114,109,0,109,95,105,110,116,101,114,112,111,108,97,116,105, +111,110,76,105,110,101,97,114,86,101,108,111,99,105,116,121,0,109,95,105, +110,116,101,114,112,111,108,97,116,105,111,110,65,110,103,117,108,97,114,86, +101,108,111,99,105,116,121,0,109,95,97,110,105,115,111,116,114,111,112,105, +99,70,114,105,99,116,105,111,110,0,109,95,99,111,110,116,97,99,116,80, +114,111,99,101,115,115,105,110,103,84,104,114,101,115,104,111,108,100,0,109, +95,100,101,97,99,116,105,118,97,116,105,111,110,84,105,109,101,0,109,95, +102,114,105,99,116,105,111,110,0,109,95,114,101,115,116,105,116,117,116,105, +111,110,0,109,95,104,105,116,70,114,97,99,116,105,111,110,0,109,95,99, +99,100,83,119,101,112,116,83,112,104,101,114,101,82,97,100,105,117,115,0, +109,95,99,99,100,77,111,116,105,111,110,84,104,114,101,115,104,111,108,100, +0,109,95,104,97,115,65,110,105,115,111,116,114,111,112,105,99,70,114,105, +99,116,105,111,110,0,109,95,99,111,108,108,105,115,105,111,110,70,108,97, +103,115,0,109,95,105,115,108,97,110,100,84,97,103,49,0,109,95,99,111, +109,112,97,110,105,111,110,73,100,0,109,95,97,99,116,105,118,97,116,105, +111,110,83,116,97,116,101,49,0,109,95,105,110,116,101,114,110,97,108,84, +121,112,101,0,109,95,99,104,101,99,107,67,111,108,108,105,100,101,87,105, +116,104,0,109,95,99,111,108,108,105,115,105,111,110,79,98,106,101,99,116, +68,97,116,97,0,109,95,105,110,118,73,110,101,114,116,105,97,84,101,110, +115,111,114,87,111,114,108,100,0,109,95,108,105,110,101,97,114,86,101,108, +111,99,105,116,121,0,109,95,97,110,103,117,108,97,114,86,101,108,111,99, +105,116,121,0,109,95,97,110,103,117,108,97,114,70,97,99,116,111,114,0, +109,95,108,105,110,101,97,114,70,97,99,116,111,114,0,109,95,103,114,97, +118,105,116,121,0,109,95,103,114,97,118,105,116,121,95,97,99,99,101,108, +101,114,97,116,105,111,110,0,109,95,105,110,118,73,110,101,114,116,105,97, +76,111,99,97,108,0,109,95,116,111,116,97,108,70,111,114,99,101,0,109, +95,116,111,116,97,108,84,111,114,113,117,101,0,109,95,105,110,118,101,114, +115,101,77,97,115,115,0,109,95,108,105,110,101,97,114,68,97,109,112,105, +110,103,0,109,95,97,110,103,117,108,97,114,68,97,109,112,105,110,103,0, +109,95,97,100,100,105,116,105,111,110,97,108,68,97,109,112,105,110,103,70, +97,99,116,111,114,0,109,95,97,100,100,105,116,105,111,110,97,108,76,105, +110,101,97,114,68,97,109,112,105,110,103,84,104,114,101,115,104,111,108,100, +83,113,114,0,109,95,97,100,100,105,116,105,111,110,97,108,65,110,103,117, +108,97,114,68,97,109,112,105,110,103,84,104,114,101,115,104,111,108,100,83, +113,114,0,109,95,97,100,100,105,116,105,111,110,97,108,65,110,103,117,108, +97,114,68,97,109,112,105,110,103,70,97,99,116,111,114,0,109,95,108,105, +110,101,97,114,83,108,101,101,112,105,110,103,84,104,114,101,115,104,111,108, +100,0,109,95,97,110,103,117,108,97,114,83,108,101,101,112,105,110,103,84, +104,114,101,115,104,111,108,100,0,109,95,97,100,100,105,116,105,111,110,97, +108,68,97,109,112,105,110,103,0,0,0,0,84,89,80,69,33,0,0,0, +99,104,97,114,0,117,99,104,97,114,0,115,104,111,114,116,0,117,115,104, +111,114,116,0,105,110,116,0,108,111,110,103,0,117,108,111,110,103,0,102, +108,111,97,116,0,100,111,117,98,108,101,0,118,111,105,100,0,80,111,105, +110,116,101,114,65,114,114,97,121,0,98,116,80,104,121,115,105,99,115,83, +121,115,116,101,109,0,76,105,115,116,66,97,115,101,0,98,116,86,101,99, +116,111,114,51,70,108,111,97,116,68,97,116,97,0,98,116,86,101,99,116, +111,114,51,68,111,117,98,108,101,68,97,116,97,0,98,116,77,97,116,114, +105,120,51,120,51,70,108,111,97,116,68,97,116,97,0,98,116,77,97,116, +114,105,120,51,120,51,68,111,117,98,108,101,68,97,116,97,0,98,116,84, +114,97,110,115,102,111,114,109,70,108,111,97,116,68,97,116,97,0,98,116, +84,114,97,110,115,102,111,114,109,68,111,117,98,108,101,68,97,116,97,0, +98,116,67,111,108,108,105,115,105,111,110,83,104,97,112,101,68,97,116,97, +0,98,116,67,111,110,118,101,120,73,110,116,101,114,110,97,108,83,104,97, +112,101,68,97,116,97,0,98,116,80,111,115,105,116,105,111,110,65,110,100, +82,97,100,105,117,115,0,98,116,77,117,108,116,105,83,112,104,101,114,101, +83,104,97,112,101,68,97,116,97,0,98,116,73,110,116,73,110,100,101,120, +68,97,116,97,0,98,116,83,104,111,114,116,73,110,116,73,110,100,101,120, +68,97,116,97,0,98,116,77,101,115,104,80,97,114,116,68,97,116,97,0, +98,116,83,116,114,105,100,105,110,103,77,101,115,104,73,110,116,101,114,102, +97,99,101,68,97,116,97,0,98,116,84,114,105,97,110,103,108,101,77,101, +115,104,83,104,97,112,101,68,97,116,97,0,98,116,67,111,110,118,101,120, +72,117,108,108,83,104,97,112,101,68,97,116,97,0,98,116,67,111,108,108, +105,115,105,111,110,79,98,106,101,99,116,68,111,117,98,108,101,68,97,116, +97,0,98,116,67,111,108,108,105,115,105,111,110,79,98,106,101,99,116,70, +108,111,97,116,68,97,116,97,0,98,116,82,105,103,105,100,66,111,100,121, +70,108,111,97,116,68,97,116,97,0,98,116,82,105,103,105,100,66,111,100, +121,68,111,117,98,108,101,68,97,116,97,0,84,76,69,78,1,0,1,0, +2,0,2,0,4,0,4,0,4,0,4,0,8,0,0,0,16,0,48,0, +16,0,16,0,32,0,48,0,96,0,64,0,-128,0,16,0,56,0,20,0, +72,0,4,0,4,0,40,0,32,0,56,0,80,0,-40,1,8,1,-16,1, +-88,3,0,0,83,84,82,67,23,0,0,0,10,0,3,0,4,0,0,0, +4,0,1,0,9,0,2,0,11,0,3,0,10,0,3,0,10,0,4,0, +10,0,5,0,12,0,2,0,9,0,6,0,9,0,7,0,13,0,1,0, +7,0,8,0,14,0,1,0,8,0,8,0,15,0,1,0,13,0,9,0, +16,0,1,0,14,0,9,0,17,0,2,0,15,0,10,0,13,0,11,0, +18,0,2,0,16,0,10,0,14,0,11,0,19,0,3,0,9,0,12,0, +4,0,13,0,0,0,14,0,20,0,5,0,19,0,15,0,13,0,16,0, +13,0,17,0,7,0,18,0,4,0,19,0,21,0,2,0,13,0,20,0, +7,0,21,0,22,0,4,0,20,0,22,0,21,0,23,0,4,0,24,0, +0,0,14,0,23,0,1,0,4,0,25,0,24,0,2,0,2,0,26,0, +2,0,25,0,25,0,6,0,13,0,27,0,14,0,28,0,23,0,29,0, +24,0,30,0,4,0,31,0,4,0,32,0,26,0,4,0,25,0,33,0, +13,0,34,0,4,0,35,0,0,0,14,0,27,0,4,0,19,0,15,0, +26,0,36,0,7,0,18,0,0,0,14,0,28,0,5,0,20,0,22,0, +13,0,37,0,14,0,38,0,4,0,39,0,0,0,40,0,29,0,24,0, +9,0,41,0,9,0,42,0,19,0,43,0,9,0,44,0,18,0,45,0, +18,0,46,0,14,0,47,0,14,0,48,0,14,0,49,0,8,0,50,0, +8,0,51,0,8,0,52,0,8,0,53,0,8,0,54,0,8,0,55,0, +8,0,56,0,4,0,57,0,4,0,58,0,4,0,59,0,4,0,60,0, +4,0,61,0,4,0,62,0,4,0,63,0,0,0,14,0,30,0,23,0, +9,0,41,0,9,0,42,0,19,0,43,0,9,0,44,0,17,0,45,0, +17,0,46,0,13,0,47,0,13,0,48,0,13,0,49,0,7,0,50,0, +7,0,51,0,7,0,52,0,7,0,53,0,7,0,54,0,7,0,55,0, +7,0,56,0,4,0,57,0,4,0,58,0,4,0,59,0,4,0,60,0, +4,0,61,0,4,0,62,0,4,0,63,0,31,0,21,0,30,0,64,0, +15,0,65,0,13,0,66,0,13,0,67,0,13,0,68,0,13,0,69,0, +13,0,70,0,13,0,71,0,13,0,72,0,13,0,73,0,13,0,74,0, +7,0,75,0,7,0,76,0,7,0,77,0,7,0,78,0,7,0,79,0, +7,0,80,0,7,0,81,0,7,0,82,0,7,0,83,0,4,0,84,0, +32,0,22,0,29,0,64,0,16,0,65,0,14,0,66,0,14,0,67,0, +14,0,68,0,14,0,69,0,14,0,70,0,14,0,71,0,14,0,72,0, +14,0,73,0,14,0,74,0,8,0,75,0,8,0,76,0,8,0,77,0, +8,0,78,0,8,0,79,0,8,0,80,0,8,0,81,0,8,0,82,0, +8,0,83,0,4,0,84,0,0,0,14,0,}; +int sBulletDNAlen64= sizeof(sBulletDNAstr64); + + +unsigned char sBulletDNAstr[]= { +83,68,78,65,78,65,77,69,85,0,0,0,109,95,115,105,122,101,0,109, +95,99,97,112,97,99,105,116,121,0,42,109,95,100,97,116,97,0,109,95, +99,111,108,108,105,115,105,111,110,83,104,97,112,101,115,0,109,95,99,111, +108,108,105,115,105,111,110,79,98,106,101,99,116,115,0,109,95,99,111,110, +115,116,114,97,105,110,116,115,0,42,102,105,114,115,116,0,42,108,97,115, +116,0,109,95,102,108,111,97,116,115,91,52,93,0,109,95,101,108,91,51, +93,0,109,95,98,97,115,105,115,0,109,95,111,114,105,103,105,110,0,42, +109,95,117,115,101,114,80,111,105,110,116,101,114,0,109,95,115,104,97,112, +101,84,121,112,101,0,109,95,112,97,100,100,105,110,103,91,52,93,0,109, +95,99,111,108,108,105,115,105,111,110,83,104,97,112,101,68,97,116,97,0, +109,95,108,111,99,97,108,83,99,97,108,105,110,103,0,109,95,105,109,112, +108,105,99,105,116,83,104,97,112,101,68,105,109,101,110,115,105,111,110,115, +0,109,95,99,111,108,108,105,115,105,111,110,77,97,114,103,105,110,0,109, +95,112,97,100,100,105,110,103,0,109,95,112,111,115,0,109,95,114,97,100, +105,117,115,0,109,95,99,111,110,118,101,120,73,110,116,101,114,110,97,108, +83,104,97,112,101,68,97,116,97,0,42,109,95,108,111,99,97,108,80,111, +115,105,116,105,111,110,65,114,114,97,121,80,116,114,0,109,95,108,111,99, +97,108,80,111,115,105,116,105,111,110,65,114,114,97,121,83,105,122,101,0, +109,95,118,97,108,117,101,0,105,110,116,0,42,109,95,118,101,114,116,105, +99,101,115,51,102,0,42,109,95,118,101,114,116,105,99,101,115,51,100,0, +42,109,95,105,110,100,105,99,101,115,51,50,0,42,109,95,105,110,100,105, +99,101,115,49,54,0,109,95,110,117,109,84,114,105,97,110,103,108,101,115, +0,109,95,110,117,109,86,101,114,116,105,99,101,115,0,42,109,95,109,101, +115,104,80,97,114,116,115,80,116,114,0,109,95,115,99,97,108,105,110,103, +0,109,95,110,117,109,77,101,115,104,80,97,114,116,115,0,109,95,109,101, +115,104,73,110,116,101,114,102,97,99,101,0,42,109,95,117,110,115,99,97, +108,101,100,80,111,105,110,116,115,70,108,111,97,116,80,116,114,0,42,109, +95,117,110,115,99,97,108,101,100,80,111,105,110,116,115,68,111,117,98,108, +101,80,116,114,0,109,95,110,117,109,85,110,115,99,97,108,101,100,80,111, +105,110,116,115,0,109,95,112,97,100,100,105,110,103,51,91,52,93,0,42, +109,95,98,114,111,97,100,112,104,97,115,101,72,97,110,100,108,101,0,42, +109,95,99,111,108,108,105,115,105,111,110,83,104,97,112,101,0,42,109,95, +114,111,111,116,67,111,108,108,105,115,105,111,110,83,104,97,112,101,0,42, +109,95,117,115,101,114,79,98,106,101,99,116,80,111,105,110,116,101,114,0, +109,95,119,111,114,108,100,84,114,97,110,115,102,111,114,109,0,109,95,105, +110,116,101,114,112,111,108,97,116,105,111,110,87,111,114,108,100,84,114,97, +110,115,102,111,114,109,0,109,95,105,110,116,101,114,112,111,108,97,116,105, +111,110,76,105,110,101,97,114,86,101,108,111,99,105,116,121,0,109,95,105, +110,116,101,114,112,111,108,97,116,105,111,110,65,110,103,117,108,97,114,86, +101,108,111,99,105,116,121,0,109,95,97,110,105,115,111,116,114,111,112,105, +99,70,114,105,99,116,105,111,110,0,109,95,99,111,110,116,97,99,116,80, +114,111,99,101,115,115,105,110,103,84,104,114,101,115,104,111,108,100,0,109, +95,100,101,97,99,116,105,118,97,116,105,111,110,84,105,109,101,0,109,95, +102,114,105,99,116,105,111,110,0,109,95,114,101,115,116,105,116,117,116,105, +111,110,0,109,95,104,105,116,70,114,97,99,116,105,111,110,0,109,95,99, +99,100,83,119,101,112,116,83,112,104,101,114,101,82,97,100,105,117,115,0, +109,95,99,99,100,77,111,116,105,111,110,84,104,114,101,115,104,111,108,100, +0,109,95,104,97,115,65,110,105,115,111,116,114,111,112,105,99,70,114,105, +99,116,105,111,110,0,109,95,99,111,108,108,105,115,105,111,110,70,108,97, +103,115,0,109,95,105,115,108,97,110,100,84,97,103,49,0,109,95,99,111, +109,112,97,110,105,111,110,73,100,0,109,95,97,99,116,105,118,97,116,105, +111,110,83,116,97,116,101,49,0,109,95,105,110,116,101,114,110,97,108,84, +121,112,101,0,109,95,99,104,101,99,107,67,111,108,108,105,100,101,87,105, +116,104,0,109,95,99,111,108,108,105,115,105,111,110,79,98,106,101,99,116, +68,97,116,97,0,109,95,105,110,118,73,110,101,114,116,105,97,84,101,110, +115,111,114,87,111,114,108,100,0,109,95,108,105,110,101,97,114,86,101,108, +111,99,105,116,121,0,109,95,97,110,103,117,108,97,114,86,101,108,111,99, +105,116,121,0,109,95,97,110,103,117,108,97,114,70,97,99,116,111,114,0, +109,95,108,105,110,101,97,114,70,97,99,116,111,114,0,109,95,103,114,97, +118,105,116,121,0,109,95,103,114,97,118,105,116,121,95,97,99,99,101,108, +101,114,97,116,105,111,110,0,109,95,105,110,118,73,110,101,114,116,105,97, +76,111,99,97,108,0,109,95,116,111,116,97,108,70,111,114,99,101,0,109, +95,116,111,116,97,108,84,111,114,113,117,101,0,109,95,105,110,118,101,114, +115,101,77,97,115,115,0,109,95,108,105,110,101,97,114,68,97,109,112,105, +110,103,0,109,95,97,110,103,117,108,97,114,68,97,109,112,105,110,103,0, +109,95,97,100,100,105,116,105,111,110,97,108,68,97,109,112,105,110,103,70, +97,99,116,111,114,0,109,95,97,100,100,105,116,105,111,110,97,108,76,105, +110,101,97,114,68,97,109,112,105,110,103,84,104,114,101,115,104,111,108,100, +83,113,114,0,109,95,97,100,100,105,116,105,111,110,97,108,65,110,103,117, +108,97,114,68,97,109,112,105,110,103,84,104,114,101,115,104,111,108,100,83, +113,114,0,109,95,97,100,100,105,116,105,111,110,97,108,65,110,103,117,108, +97,114,68,97,109,112,105,110,103,70,97,99,116,111,114,0,109,95,108,105, +110,101,97,114,83,108,101,101,112,105,110,103,84,104,114,101,115,104,111,108, +100,0,109,95,97,110,103,117,108,97,114,83,108,101,101,112,105,110,103,84, +104,114,101,115,104,111,108,100,0,109,95,97,100,100,105,116,105,111,110,97, +108,68,97,109,112,105,110,103,0,0,0,0,84,89,80,69,33,0,0,0, +99,104,97,114,0,117,99,104,97,114,0,115,104,111,114,116,0,117,115,104, +111,114,116,0,105,110,116,0,108,111,110,103,0,117,108,111,110,103,0,102, +108,111,97,116,0,100,111,117,98,108,101,0,118,111,105,100,0,80,111,105, +110,116,101,114,65,114,114,97,121,0,98,116,80,104,121,115,105,99,115,83, +121,115,116,101,109,0,76,105,115,116,66,97,115,101,0,98,116,86,101,99, +116,111,114,51,70,108,111,97,116,68,97,116,97,0,98,116,86,101,99,116, +111,114,51,68,111,117,98,108,101,68,97,116,97,0,98,116,77,97,116,114, +105,120,51,120,51,70,108,111,97,116,68,97,116,97,0,98,116,77,97,116, +114,105,120,51,120,51,68,111,117,98,108,101,68,97,116,97,0,98,116,84, +114,97,110,115,102,111,114,109,70,108,111,97,116,68,97,116,97,0,98,116, +84,114,97,110,115,102,111,114,109,68,111,117,98,108,101,68,97,116,97,0, +98,116,67,111,108,108,105,115,105,111,110,83,104,97,112,101,68,97,116,97, +0,98,116,67,111,110,118,101,120,73,110,116,101,114,110,97,108,83,104,97, +112,101,68,97,116,97,0,98,116,80,111,115,105,116,105,111,110,65,110,100, +82,97,100,105,117,115,0,98,116,77,117,108,116,105,83,112,104,101,114,101, +83,104,97,112,101,68,97,116,97,0,98,116,73,110,116,73,110,100,101,120, +68,97,116,97,0,98,116,83,104,111,114,116,73,110,116,73,110,100,101,120, +68,97,116,97,0,98,116,77,101,115,104,80,97,114,116,68,97,116,97,0, +98,116,83,116,114,105,100,105,110,103,77,101,115,104,73,110,116,101,114,102, +97,99,101,68,97,116,97,0,98,116,84,114,105,97,110,103,108,101,77,101, +115,104,83,104,97,112,101,68,97,116,97,0,98,116,67,111,110,118,101,120, +72,117,108,108,83,104,97,112,101,68,97,116,97,0,98,116,67,111,108,108, +105,115,105,111,110,79,98,106,101,99,116,68,111,117,98,108,101,68,97,116, +97,0,98,116,67,111,108,108,105,115,105,111,110,79,98,106,101,99,116,70, +108,111,97,116,68,97,116,97,0,98,116,82,105,103,105,100,66,111,100,121, +70,108,111,97,116,68,97,116,97,0,98,116,82,105,103,105,100,66,111,100, +121,68,111,117,98,108,101,68,97,116,97,0,84,76,69,78,1,0,1,0, +2,0,2,0,4,0,4,0,4,0,4,0,8,0,0,0,12,0,36,0, +8,0,16,0,32,0,48,0,96,0,64,0,-128,0,12,0,52,0,20,0, +64,0,4,0,4,0,24,0,28,0,48,0,68,0,-56,1,-8,0,-32,1, +-104,3,0,0,83,84,82,67,23,0,0,0,10,0,3,0,4,0,0,0, +4,0,1,0,9,0,2,0,11,0,3,0,10,0,3,0,10,0,4,0, +10,0,5,0,12,0,2,0,9,0,6,0,9,0,7,0,13,0,1,0, +7,0,8,0,14,0,1,0,8,0,8,0,15,0,1,0,13,0,9,0, +16,0,1,0,14,0,9,0,17,0,2,0,15,0,10,0,13,0,11,0, +18,0,2,0,16,0,10,0,14,0,11,0,19,0,3,0,9,0,12,0, +4,0,13,0,0,0,14,0,20,0,5,0,19,0,15,0,13,0,16,0, +13,0,17,0,7,0,18,0,4,0,19,0,21,0,2,0,13,0,20,0, +7,0,21,0,22,0,4,0,20,0,22,0,21,0,23,0,4,0,24,0, +0,0,14,0,23,0,1,0,4,0,25,0,24,0,2,0,2,0,26,0, +2,0,25,0,25,0,6,0,13,0,27,0,14,0,28,0,23,0,29,0, +24,0,30,0,4,0,31,0,4,0,32,0,26,0,4,0,25,0,33,0, +13,0,34,0,4,0,35,0,0,0,14,0,27,0,4,0,19,0,15,0, +26,0,36,0,7,0,18,0,0,0,14,0,28,0,5,0,20,0,22,0, +13,0,37,0,14,0,38,0,4,0,39,0,0,0,40,0,29,0,24,0, +9,0,41,0,9,0,42,0,19,0,43,0,9,0,44,0,18,0,45,0, +18,0,46,0,14,0,47,0,14,0,48,0,14,0,49,0,8,0,50,0, +8,0,51,0,8,0,52,0,8,0,53,0,8,0,54,0,8,0,55,0, +8,0,56,0,4,0,57,0,4,0,58,0,4,0,59,0,4,0,60,0, +4,0,61,0,4,0,62,0,4,0,63,0,0,0,14,0,30,0,23,0, +9,0,41,0,9,0,42,0,19,0,43,0,9,0,44,0,17,0,45,0, +17,0,46,0,13,0,47,0,13,0,48,0,13,0,49,0,7,0,50,0, +7,0,51,0,7,0,52,0,7,0,53,0,7,0,54,0,7,0,55,0, +7,0,56,0,4,0,57,0,4,0,58,0,4,0,59,0,4,0,60,0, +4,0,61,0,4,0,62,0,4,0,63,0,31,0,21,0,30,0,64,0, +15,0,65,0,13,0,66,0,13,0,67,0,13,0,68,0,13,0,69,0, +13,0,70,0,13,0,71,0,13,0,72,0,13,0,73,0,13,0,74,0, +7,0,75,0,7,0,76,0,7,0,77,0,7,0,78,0,7,0,79,0, +7,0,80,0,7,0,81,0,7,0,82,0,7,0,83,0,4,0,84,0, +32,0,22,0,29,0,64,0,16,0,65,0,14,0,66,0,14,0,67,0, +14,0,68,0,14,0,69,0,14,0,70,0,14,0,71,0,14,0,72,0, +14,0,73,0,14,0,74,0,8,0,75,0,8,0,76,0,8,0,77,0, +8,0,78,0,8,0,79,0,8,0,80,0,8,0,81,0,8,0,82,0, +8,0,83,0,4,0,84,0,0,0,14,0,}; int sBulletDNAlen= sizeof(sBulletDNAstr); diff --git a/src/LinearMath/btSerializer.h b/src/LinearMath/btSerializer.h index 1f73b9019..ded3f3898 100644 --- a/src/LinearMath/btSerializer.h +++ b/src/LinearMath/btSerializer.h @@ -23,9 +23,14 @@ subject to the following restrictions: #include + ///only the 32bit versions for now extern unsigned char sBulletDNAstr[]; extern int sBulletDNAlen; +extern unsigned char sBulletDNAstr64[]; +extern int sBulletDNAlen64; + + class btChunk { @@ -263,12 +268,18 @@ public: if (VOID_IS_8) { - //64bit not yet supported (soon) - btAssert(0); - return; +//#if _WIN64 + initDNA((const char*)sBulletDNAstr64,sBulletDNAlen64); +//#else +// btAssert(0); +//#endif } else { +//#ifndef _WIN64 initDNA((const char*)sBulletDNAstr,sBulletDNAlen); +//#else +// btAssert(0); +//#endif } } @@ -282,28 +293,35 @@ public: { m_currentSize = BT_HEADER_LENGTH; - memcpy(m_buffer, "BULLET ", 7); - int endian= 1; - endian= ((char*)&endian)[0]; +#ifdef BT_USE_DOUBLE_PRECISION + memcpy(m_buffer, "BULLETd", 7); +#else + memcpy(m_buffer, "BULLETf", 7); +#endif //BT_USE_DOUBLE_PRECISION + + int littleEndian= 1; + littleEndian= ((char*)&littleEndian)[0]; - if (endian) - { - m_buffer[7] = '_'; - } else - { - m_buffer[7] = '-'; - } if (sizeof(void*)==8) { - m_buffer[8]='V'; + m_buffer[7] = '-'; } else { - m_buffer[8]='v'; + m_buffer[7] = '_'; } + if (littleEndian) + { + m_buffer[8]='v'; + } else + { + m_buffer[8]='V'; + } + + m_buffer[9] = '2'; m_buffer[10] = '7'; - m_buffer[11] = '5'; + m_buffer[11] = '6'; } @@ -327,6 +345,7 @@ public: virtual void finalizeChunk(btChunk* chunk, const char* structType, int chunkCode,void* oldPtr) const { chunk->m_dna_nr = getReverseType(structType); + chunk->m_chunkCode = chunkCode; chunk->m_oldPtr = oldPtr; } @@ -339,14 +358,14 @@ public: { unsigned char* ptr = m_buffer+m_currentSize; - m_currentSize += size*numElements+sizeof(btChunk); + m_currentSize += int(size)*numElements+sizeof(btChunk); unsigned char* data = ptr + sizeof(btChunk); btChunk* chunk = (btChunk*)ptr; chunk->m_chunkCode = 0; chunk->m_oldPtr = data; - chunk->m_length = size*numElements; + chunk->m_length = int(size)*numElements; chunk->m_number = numElements; m_chunkPtrs.push_back(chunk); diff --git a/src/LinearMath/btTransform.h b/src/LinearMath/btTransform.h index 67e4dd2be..916133f0f 100644 --- a/src/LinearMath/btTransform.h +++ b/src/LinearMath/btTransform.h @@ -20,6 +20,13 @@ subject to the following restrictions: #include "btMatrix3x3.h" +#ifdef BT_USE_DOUBLE_PRECISION +#define btTransformData btTransformDoubleData +#else +#define btTransformData btTransformFloatData +#endif + + /**@brief The btTransform class supports rigid transforms with only translation and rotation and no scaling/shear. @@ -205,6 +212,10 @@ public: void deSerialize(const struct btTransformData& dataIn); + void deSerializeDouble(const struct btTransformDoubleData& dataIn); + + void deSerializeFloat(const struct btTransformFloatData& dataIn); + }; @@ -237,13 +248,22 @@ SIMD_FORCE_INLINE bool operator==(const btTransform& t1, const btTransform& t2) t1.getOrigin() == t2.getOrigin() ); } + ///for serialization -struct btTransformData +struct btTransformFloatData { - btMatrix3x3Data m_basis; - btVector3Data m_origin; + btMatrix3x3FloatData m_basis; + btVector3FloatData m_origin; }; +struct btTransformDoubleData +{ + btMatrix3x3DoubleData m_basis; + btVector3DoubleData m_origin; +}; + + + SIMD_FORCE_INLINE void btTransform::serialize(btTransformData& dataOut) const { m_basis.serialize(dataOut.m_basis); @@ -256,6 +276,19 @@ SIMD_FORCE_INLINE void btTransform::deSerialize(const btTransformData& dataIn) m_origin.deSerialize(dataIn.m_origin); } +SIMD_FORCE_INLINE void btTransform::deSerializeFloat(const btTransformFloatData& dataIn) +{ + m_basis.deSerializeFloat(dataIn.m_basis); + m_origin.deSerializeFloat(dataIn.m_origin); +} + +SIMD_FORCE_INLINE void btTransform::deSerializeDouble(const btTransformDoubleData& dataIn) +{ + m_basis.deSerializeDouble(dataIn.m_basis); + m_origin.deSerializeDouble(dataIn.m_origin); +} + + #endif diff --git a/src/LinearMath/btVector3.h b/src/LinearMath/btVector3.h index c1c40aa22..1e144c9d0 100644 --- a/src/LinearMath/btVector3.h +++ b/src/LinearMath/btVector3.h @@ -21,6 +21,14 @@ subject to the following restrictions: #include "btScalar.h" #include "btMinMax.h" +#ifdef BT_USE_DOUBLE_PRECISION +#define btVector3Data btVector3DoubleData +#define btVector3DataName "btVector3DoubleData" +#else +#define btVector3Data btVector3FloatData +#define btVector3DataName "btVector3FloatData" +#endif //BT_USE_DOUBLE_PRECISION + @@ -330,10 +338,18 @@ public: return length2() < SIMD_EPSILON; } - SIMD_FORCE_INLINE void serialize(struct btVector3Data& dataOut) const; SIMD_FORCE_INLINE void deSerialize(const struct btVector3Data& dataIn); + + SIMD_FORCE_INLINE void serializeFloat(struct btVector3FloatData& dataOut) const; + + SIMD_FORCE_INLINE void deSerializeFloat(const struct btVector3FloatData& dataIn); + + SIMD_FORCE_INLINE void serializeDouble(struct btVector3DoubleData& dataOut) const; + + SIMD_FORCE_INLINE void deSerializeDouble(const struct btVector3DoubleData& dataIn); + }; /**@brief Return the sum of two vectors (Point symantics)*/ @@ -671,10 +687,6 @@ SIMD_FORCE_INLINE void btPlaneSpace1 (const btVector3& n, btVector3& p, btVector } } -struct btVector3Data -{ - btScalar m_floats[4]; -}; struct btVector3FloatData { @@ -684,8 +696,37 @@ struct btVector3FloatData struct btVector3DoubleData { double m_floats[4]; + }; +SIMD_FORCE_INLINE void btVector3::serializeFloat(struct btVector3FloatData& dataOut) const +{ + ///could also do a memcpy, check if it is worth it + for (int i=0;i<4;i++) + dataOut.m_floats[i] = float(m_floats[i]); +} + +SIMD_FORCE_INLINE void btVector3::deSerializeFloat(const struct btVector3FloatData& dataIn) +{ + for (int i=0;i<4;i++) + m_floats[i] = btScalar(dataIn.m_floats[i]); +} + + +SIMD_FORCE_INLINE void btVector3::serializeDouble(struct btVector3DoubleData& dataOut) const +{ + ///could also do a memcpy, check if it is worth it + for (int i=0;i<4;i++) + dataOut.m_floats[i] = double(m_floats[i]); +} + +SIMD_FORCE_INLINE void btVector3::deSerializeDouble(const struct btVector3DoubleData& dataIn) +{ + for (int i=0;i<4;i++) + m_floats[i] = btScalar(dataIn.m_floats[i]); +} + + SIMD_FORCE_INLINE void btVector3::serialize(struct btVector3Data& dataOut) const { ///could also do a memcpy, check if it is worth it