add missing Demos/BulletXmlImportDemo

serialize DynamicsWorldInfo
This commit is contained in:
erwin.coumans 2012-09-22 02:06:09 +00:00
parent f2c9cdfb11
commit 6f60a388c6
20 changed files with 25824 additions and 64 deletions

View File

@ -0,0 +1,164 @@
/*
Bullet Continuous Collision Detection and Physics Library
Copyright (c) 2003-2010 Erwin Coumans http://continuousphysics.com/Bullet/
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.
*/
#include "BulletXmlImportDemo.h"
#include "GlutStuff.h"
///btBulletDynamicsCommon.h is the main Bullet include file, contains most common include files.
#include "btBulletDynamicsCommon.h"
#include "LinearMath/btSerializer.h"
#include "btBulletFile.h"
#include "btBulletWorldImporter.h"
#include "btBulletXmlWorldImporter.h"
#include "BulletCollision/Gimpact/btGImpactCollisionAlgorithm.h"
#include <stdio.h> //printf debugging
void BulletXmlImportDemo::initPhysics()
{
setTexturing(true);
setShadows(true);
setCameraDistance(btScalar(30.));
setupEmptyDynamicsWorld();
btBulletXmlWorldImporter* importer = new btBulletXmlWorldImporter(m_dynamicsWorld);
importer->loadFile("bullet_basic.xml");
// importer->loadFile("bulletser.xml");
// importer->loadFile("bullet_constraints.xml");
}
void BulletXmlImportDemo::clientMoveAndDisplay()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
//simple dynamics world doesn't handle fixed-time-stepping
float ms = getDeltaTimeMicroseconds();
///step the simulation
if (m_dynamicsWorld)
{
m_dynamicsWorld->stepSimulation(ms / 1000000.f);
m_dynamicsWorld->debugDrawWorld();
}
renderme();
glFlush();
swapBuffers();
}
void BulletXmlImportDemo::displayCallback(void) {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
renderme();
//optional but useful: debug drawing to detect problems
if (m_dynamicsWorld)
m_dynamicsWorld->debugDrawWorld();
glFlush();
swapBuffers();
}
void BulletXmlImportDemo::setupEmptyDynamicsWorld()
{
m_collisionConfiguration = new btDefaultCollisionConfiguration();
///use the default collision dispatcher. For parallel processing you can use a diffent dispatcher (see Extras/BulletMultiThreaded)
m_dispatcher = new btCollisionDispatcher(m_collisionConfiguration);
btGImpactCollisionAlgorithm::registerAlgorithm(m_dispatcher);
m_broadphase = new btDbvtBroadphase();
///the default constraint solver. For parallel processing you can use a different solver (see Extras/BulletMultiThreaded)
btSequentialImpulseConstraintSolver* sol = new btSequentialImpulseConstraintSolver;
m_solver = sol;
m_dynamicsWorld = new btDiscreteDynamicsWorld(m_dispatcher,m_broadphase,m_solver,m_collisionConfiguration);
//btGImpactCollisionAlgorithm::registerAlgorithm((btCollisionDispatcher*)m_dynamicsWorld->getDispatcher());
m_dynamicsWorld->setGravity(btVector3(0,-10,0));
}
BulletXmlImportDemo::~BulletXmlImportDemo()
{
m_fileLoader->deleteAllData();
delete m_fileLoader;
exitPhysics();
}
void BulletXmlImportDemo::exitPhysics()
{
//cleanup in the reverse order of creation/initialization
//remove the rigidbodies from the dynamics world and delete them
int i;
for (i=m_dynamicsWorld->getNumCollisionObjects()-1; i>=0 ;i--)
{
btCollisionObject* obj = m_dynamicsWorld->getCollisionObjectArray()[i];
btRigidBody* body = btRigidBody::upcast(obj);
if (body && body->getMotionState())
{
delete body->getMotionState();
}
m_dynamicsWorld->removeCollisionObject( obj );
delete obj;
}
//delete collision shapes
for (int j=0;j<m_collisionShapes.size();j++)
{
btCollisionShape* shape = m_collisionShapes[j];
delete shape;
}
m_collisionShapes.clear();
delete m_dynamicsWorld;
delete m_solver;
delete m_broadphase;
delete m_dispatcher;
delete m_collisionConfiguration;
}

View File

@ -0,0 +1,83 @@
/*
Bullet Continuous Collision Detection and Physics Library
Copyright (c) 2003-2010 Erwin Coumans http://continuousphysics.com/Bullet/
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.
*/
#ifndef SERIALIZE_DEMO_H
#define SERIALIZE_DEMO_H
#ifdef _WINDOWS
#include "Win32DemoApplication.h"
#define PlatformDemoApplication Win32DemoApplication
#else
#include "GlutDemoApplication.h"
#define PlatformDemoApplication GlutDemoApplication
#endif
#include "LinearMath/btAlignedObjectArray.h"
class btBroadphaseInterface;
class btCollisionShape;
class btOverlappingPairCache;
class btCollisionDispatcher;
class btConstraintSolver;
struct btCollisionAlgorithmCreateFunc;
class btDefaultCollisionConfiguration;
///BulletXmlImportDemo shows how to use save and load XML Bullet physics files (work-in-progress)
class BulletXmlImportDemo : public PlatformDemoApplication
{
//keep the collision shapes, for deletion/cleanup
btAlignedObjectArray<btCollisionShape*> m_collisionShapes;
btBroadphaseInterface* m_broadphase;
btCollisionDispatcher* m_dispatcher;
btConstraintSolver* m_solver;
btDefaultCollisionConfiguration* m_collisionConfiguration;
class btBulletWorldImporter* m_fileLoader;
public:
BulletXmlImportDemo()
{
}
virtual ~BulletXmlImportDemo();
void initPhysics();
void setupEmptyDynamicsWorld();
void exitPhysics();
virtual void clientMoveAndDisplay();
virtual void displayCallback();
static DemoApplication* Create()
{
BulletXmlImportDemo* demo = new BulletXmlImportDemo;
demo->myinit();
demo->initPhysics();
return demo;
}
};
#endif //SERIALIZE_DEMO_H

View File

@ -0,0 +1,96 @@
# This is basically the overall name of the project in Visual Studio this is the name of the Solution File
# For every executable you have with a main method you should have an add_executable line below.
# For every add executable line you should list every .cpp and .h file you have associated with that executable.
# This is the variable for Windows. I use this to define the root of my directory structure.
SET(GLUT_ROOT ${BULLET_PHYSICS_SOURCE_DIR}/Glut)
# You shouldn't have to modify anything below this line
########################################################
IF(BUILD_AMD_OPENCL_DEMOS)
SUBDIRS(AMD)
ENDIF()
INCLUDE_DIRECTORIES(
${BULLET_PHYSICS_SOURCE_DIR}/src
${BULLET_PHYSICS_SOURCE_DIR}/Demos/OpenGL
${BULLET_PHYSICS_SOURCE_DIR}/Extras/Serialize/BulletFileLoader
${BULLET_PHYSICS_SOURCE_DIR}/Extras/Serialize/BulletWorldImporter
${BULLET_PHYSICS_SOURCE_DIR}/Extras/Serialize/BulletXmlWorldImporter
)
ADD_DEFINITIONS(-DDESERIALIZE_SOFT_BODIES)
IF (USE_GLUT)
LINK_LIBRARIES(
OpenGLSupport BulletXmlWorldImporter BulletWorldImporter BulletSoftBody BulletDynamics BulletCollision BulletFileLoader LinearMath ${GLUT_glut_LIBRARY} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY}
)
IF (WIN32)
ADD_EXECUTABLE(AppBulletXmlImportDemo
main.cpp
BulletXmlImportDemo.cpp
BulletXmlImportDemo.h
${BULLET_PHYSICS_SOURCE_DIR}/build/bullet.rc
)
ELSE()
ADD_EXECUTABLE(AppBulletXmlImportDemo
main.cpp
BulletXmlImportDemo.cpp
BulletXmlImportDemo.h
)
ENDIF()
IF (NOT INTERNAL_CREATE_DISTRIBUTABLE_MSVC_PROJECTFILES)
IF (WIN32)
IF (CMAKE_CL_64)
ADD_CUSTOM_COMMAND(
TARGET AppBulletXmlImportDemo
POST_BUILD
COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${BULLET_PHYSICS_SOURCE_DIR}/glut64.dll ${CMAKE_CURRENT_BINARY_DIR}
)
ELSE(CMAKE_CL_64)
ADD_CUSTOM_COMMAND(
TARGET AppBulletXmlImportDemo
POST_BUILD
COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${BULLET_PHYSICS_SOURCE_DIR}/GLUT32.DLL ${CMAKE_CURRENT_BINARY_DIR}
)
ENDIF(CMAKE_CL_64)
ENDIF(WIN32)
ENDIF (NOT INTERNAL_CREATE_DISTRIBUTABLE_MSVC_PROJECTFILES)
ELSE (USE_GLUT)
LINK_LIBRARIES(
OpenGLSupport BulletXmlWorldImporter BulletWorldImporter BulletSoftBody BulletDynamics BulletCollision BulletFileLoader LinearMath ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY}
)
ADD_EXECUTABLE(AppBulletXmlImportDemo
WIN32
../OpenGL/Win32AppMain.cpp
Win32BulletXmlImportDemo.cpp
BulletXmlImportDemo.cpp
BulletXmlImportDemo.h
${BULLET_PHYSICS_SOURCE_DIR}/build/bullet.rc
)
ENDIF (USE_GLUT)
IF (NOT INTERNAL_CREATE_DISTRIBUTABLE_MSVC_PROJECTFILES AND NOT INTERNAL_UPDATE_SERIALIZATION_STRUCTURES)
ADD_CUSTOM_COMMAND(
TARGET AppBulletXmlImportDemo
POST_BUILD
COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${BULLET_PHYSICS_SOURCE_DIR}/Demos/BulletXmlImportDemo/bullet_basic.xml ${CMAKE_CURRENT_BINARY_DIR}/bullet_basic.xml
)
ENDIF ()
IF (INTERNAL_ADD_POSTFIX_EXECUTABLE_NAMES)
SET_TARGET_PROPERTIES(AppBulletXmlImportDemo PROPERTIES DEBUG_POSTFIX "_Debug")
SET_TARGET_PROPERTIES(AppBulletXmlImportDemo PROPERTIES MINSIZEREL_POSTFIX "_MinsizeRel")
SET_TARGET_PROPERTIES(AppBulletXmlImportDemo PROPERTIES RELWITHDEBINFO_POSTFIX "_RelWithDebugInfo")
ENDIF(INTERNAL_ADD_POSTFIX_EXECUTABLE_NAMES)

View File

@ -0,0 +1,25 @@
#ifdef _WINDOWS
/*
Bullet Continuous Collision Detection and Physics Library
Copyright (c) 2003-2010 Erwin Coumans http://bulletphysics.org
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.
*/
#include "BulletXmlImportDemo.h"
///The 'createDemo' function is called from Bullet/Demos/OpenGL/Win32AppMain.cpp to instantiate this particular demo
DemoApplication* createDemo()
{
return new BulletXmlImportDemo();
}
#endif

View File

@ -0,0 +1,668 @@
<?xml version="1.0" encoding="utf-8"?>
<bullet_physics version=281 itemcount = 9>
<btDynamicsWorldFloatData pointer=2>
<m_solverInfo type="btContactSolverInfoFloatData">
<m_tau type="float"> 0.600000 </m_tau>
<m_damping type="float"> 1.000000 </m_damping>
<m_friction type="float"> 0.300000 </m_friction>
<m_timeStep type="float"> 0.016667 </m_timeStep>
<m_restitution type="float"> 0.000000 </m_restitution>
<m_maxErrorReduction type="float"> 20.000000 </m_maxErrorReduction>
<m_sor type="float"> 1.000000 </m_sor>
<m_erp type="float"> 0.200000 </m_erp>
<m_erp2 type="float"> 0.800000 </m_erp2>
<m_globalCfm type="float"> 0.000000 </m_globalCfm>
<m_splitImpulsePenetrationThreshold type="float"> -0.040000 </m_splitImpulsePenetrationThreshold>
<m_splitImpulseTurnErp type="float"> 0.100000 </m_splitImpulseTurnErp>
<m_linearSlop type="float"> 0.000000 </m_linearSlop>
<m_warmstartingFactor type="float"> 0.850000 </m_warmstartingFactor>
<m_maxGyroscopicForce type="float"> 100.000000 </m_maxGyroscopicForce>
<m_singleAxisRollingFrictionThreshold type="float"> 1000000015047466200000000000000.000000 </m_singleAxisRollingFrictionThreshold>
<m_numIterations type="int"> 10 </m_numIterations>
<m_solverMode type="int"> 260 </m_solverMode>
<m_restingContactRestitutionThreshold type="int"> 2 </m_restingContactRestitutionThreshold>
<m_minimumSolverBatchSize type="int"> 128 </m_minimumSolverBatchSize>
<m_splitImpulse type="int"> 1 </m_splitImpulse>
<m_padding type="char" count=4> 0 0 0 0 </m_padding>
</m_solverInfo>
<m_gravity type="btVector3FloatData">
<m_floats type="float" count=4> 0.000000 -10.000000 0.000000 0.000000 </m_floats>
</m_gravity>
</btDynamicsWorldFloatData>
<btRigidBodyFloatData pointer=4>
<m_collisionObjectData type="btCollisionObjectFloatData">
<m_broadphaseHandle type="pointer"> 0 </m_broadphaseHandle>
<m_collisionShape type="pointer"> 3 </m_collisionShape>
<m_rootCollisionShape type="pointer"> 0 </m_rootCollisionShape>
<m_name type="pointer"> 0 </m_name>
<m_worldTransform type="btTransformFloatData">
<m_basis type="btMatrix3x3FloatData">
<m_el type="btVector3FloatData" count=3>
<m_floats type="float" count=4> 1.000000 0.000000 0.000000 0.000000 </m_floats>
<m_floats type="float" count=4> 0.000000 1.000000 0.000000 0.000000 </m_floats>
<m_floats type="float" count=4> 0.000000 0.000000 1.000000 0.000000 </m_floats>
</m_el>
</m_basis>
<m_origin type="btVector3FloatData">
<m_floats type="float" count=4> 0.000000 -50.000000 0.000000 0.000000 </m_floats>
</m_origin>
</m_worldTransform>
<m_interpolationWorldTransform type="btTransformFloatData">
<m_basis type="btMatrix3x3FloatData">
<m_el type="btVector3FloatData" count=3>
<m_floats type="float" count=4> 1.000000 0.000000 0.000000 0.000000 </m_floats>
<m_floats type="float" count=4> 0.000000 1.000000 0.000000 0.000000 </m_floats>
<m_floats type="float" count=4> 0.000000 0.000000 1.000000 0.000000 </m_floats>
</m_el>
</m_basis>
<m_origin type="btVector3FloatData">
<m_floats type="float" count=4> 0.000000 0.000000 0.000000 0.000000 </m_floats>
</m_origin>
</m_interpolationWorldTransform>
<m_interpolationLinearVelocity type="btVector3FloatData">
<m_floats type="float" count=4> 0.000000 0.000000 0.000000 0.000000 </m_floats>
</m_interpolationLinearVelocity>
<m_interpolationAngularVelocity type="btVector3FloatData">
<m_floats type="float" count=4> 0.000000 0.000000 0.000000 0.000000 </m_floats>
</m_interpolationAngularVelocity>
<m_anisotropicFriction type="btVector3FloatData">
<m_floats type="float" count=4> 1.000000 1.000000 1.000000 0.000000 </m_floats>
</m_anisotropicFriction>
<m_contactProcessingThreshold type="float"> 999999984306749440.000000 </m_contactProcessingThreshold>
<m_deactivationTime type="float"> 0.000000 </m_deactivationTime>
<m_friction type="float"> 0.500000 </m_friction>
<m_rollingFriction type="float"> -431602080.000000 </m_rollingFriction>
<m_restitution type="float"> 0.000000 </m_restitution>
<m_hitFraction type="float"> 1.000000 </m_hitFraction>
<m_ccdSweptSphereRadius type="float"> 0.000000 </m_ccdSweptSphereRadius>
<m_ccdMotionThreshold type="float"> 0.000000 </m_ccdMotionThreshold>
<m_hasAnisotropicFriction type="int"> 0 </m_hasAnisotropicFriction>
<m_collisionFlags type="int"> 1 </m_collisionFlags>
<m_islandTag1 type="int"> -1 </m_islandTag1>
<m_companionId type="int"> -2 </m_companionId>
<m_activationState1 type="int"> 2 </m_activationState1>
<m_internalType type="int"> 2 </m_internalType>
<m_checkCollideWith type="int"> 0 </m_checkCollideWith>
<m_padding type="char" count=4> -51 -51 -51 -51 </m_padding>
</m_collisionObjectData>
<m_invInertiaTensorWorld type="btMatrix3x3FloatData">
<m_el type="btVector3FloatData" count=3>
<m_floats type="float" count=4> 0.000000 0.000000 0.000000 0.000000 </m_floats>
<m_floats type="float" count=4> 0.000000 0.000000 0.000000 0.000000 </m_floats>
<m_floats type="float" count=4> 0.000000 0.000000 0.000000 0.000000 </m_floats>
</m_el>
</m_invInertiaTensorWorld>
<m_linearVelocity type="btVector3FloatData">
<m_floats type="float" count=4> 0.000000 0.000000 0.000000 0.000000 </m_floats>
</m_linearVelocity>
<m_angularVelocity type="btVector3FloatData">
<m_floats type="float" count=4> 0.000000 0.000000 0.000000 0.000000 </m_floats>
</m_angularVelocity>
<m_angularFactor type="btVector3FloatData">
<m_floats type="float" count=4> 1.000000 1.000000 1.000000 0.000000 </m_floats>
</m_angularFactor>
<m_linearFactor type="btVector3FloatData">
<m_floats type="float" count=4> 1.000000 1.000000 1.000000 0.000000 </m_floats>
</m_linearFactor>
<m_gravity type="btVector3FloatData">
<m_floats type="float" count=4> 0.000000 0.000000 0.000000 0.000000 </m_floats>
</m_gravity>
<m_gravity_acceleration type="btVector3FloatData">
<m_floats type="float" count=4> 0.000000 0.000000 0.000000 0.000000 </m_floats>
</m_gravity_acceleration>
<m_invInertiaLocal type="btVector3FloatData">
<m_floats type="float" count=4> 0.000000 0.000000 0.000000 0.000000 </m_floats>
</m_invInertiaLocal>
<m_totalForce type="btVector3FloatData">
<m_floats type="float" count=4> 0.000000 0.000000 0.000000 0.000000 </m_floats>
</m_totalForce>
<m_totalTorque type="btVector3FloatData">
<m_floats type="float" count=4> 0.000000 0.000000 0.000000 0.000000 </m_floats>
</m_totalTorque>
<m_inverseMass type="float"> 0.000000 </m_inverseMass>
<m_linearDamping type="float"> 0.000000 </m_linearDamping>
<m_angularDamping type="float"> 0.000000 </m_angularDamping>
<m_additionalDampingFactor type="float"> 0.005000 </m_additionalDampingFactor>
<m_additionalLinearDampingThresholdSqr type="float"> 0.010000 </m_additionalLinearDampingThresholdSqr>
<m_additionalAngularDampingThresholdSqr type="float"> 0.010000 </m_additionalAngularDampingThresholdSqr>
<m_additionalAngularDampingFactor type="float"> 0.010000 </m_additionalAngularDampingFactor>
<m_linearSleepingThreshold type="float"> 0.800000 </m_linearSleepingThreshold>
<m_angularSleepingThreshold type="float"> 1.000000 </m_angularSleepingThreshold>
<m_additionalDamping type="int"> 0 </m_additionalDamping>
</btRigidBodyFloatData>
<btRigidBodyFloatData pointer=6>
<m_collisionObjectData type="btCollisionObjectFloatData">
<m_broadphaseHandle type="pointer"> 0 </m_broadphaseHandle>
<m_collisionShape type="pointer"> 5 </m_collisionShape>
<m_rootCollisionShape type="pointer"> 0 </m_rootCollisionShape>
<m_name type="pointer"> 0 </m_name>
<m_worldTransform type="btTransformFloatData">
<m_basis type="btMatrix3x3FloatData">
<m_el type="btVector3FloatData" count=3>
<m_floats type="float" count=4> 1.000000 0.000000 0.000000 0.000000 </m_floats>
<m_floats type="float" count=4> 0.000000 1.000000 0.000000 0.000000 </m_floats>
<m_floats type="float" count=4> 0.000000 0.000000 1.000000 0.000000 </m_floats>
</m_el>
</m_basis>
<m_origin type="btVector3FloatData">
<m_floats type="float" count=4> -5.000000 14.166666 -3.000000 0.000000 </m_floats>
</m_origin>
</m_worldTransform>
<m_interpolationWorldTransform type="btTransformFloatData">
<m_basis type="btMatrix3x3FloatData">
<m_el type="btVector3FloatData" count=3>
<m_floats type="float" count=4> 1.000000 0.000000 0.000000 0.000000 </m_floats>
<m_floats type="float" count=4> 0.000000 1.000000 0.000000 0.000000 </m_floats>
<m_floats type="float" count=4> 0.000000 0.000000 1.000000 0.000000 </m_floats>
</m_el>
</m_basis>
<m_origin type="btVector3FloatData">
<m_floats type="float" count=4> -5.000000 14.166666 -3.000000 0.000000 </m_floats>
</m_origin>
</m_interpolationWorldTransform>
<m_interpolationLinearVelocity type="btVector3FloatData">
<m_floats type="float" count=4> 0.000000 -4.000000 0.000000 0.000000 </m_floats>
</m_interpolationLinearVelocity>
<m_interpolationAngularVelocity type="btVector3FloatData">
<m_floats type="float" count=4> 0.000000 0.000000 0.000000 0.000000 </m_floats>
</m_interpolationAngularVelocity>
<m_anisotropicFriction type="btVector3FloatData">
<m_floats type="float" count=4> 1.000000 1.000000 1.000000 0.000000 </m_floats>
</m_anisotropicFriction>
<m_contactProcessingThreshold type="float"> 999999984306749440.000000 </m_contactProcessingThreshold>
<m_deactivationTime type="float"> 0.000000 </m_deactivationTime>
<m_friction type="float"> 0.500000 </m_friction>
<m_rollingFriction type="float"> -431602080.000000 </m_rollingFriction>
<m_restitution type="float"> 0.000000 </m_restitution>
<m_hitFraction type="float"> 1.000000 </m_hitFraction>
<m_ccdSweptSphereRadius type="float"> 0.000000 </m_ccdSweptSphereRadius>
<m_ccdMotionThreshold type="float"> 0.000000 </m_ccdMotionThreshold>
<m_hasAnisotropicFriction type="int"> 0 </m_hasAnisotropicFriction>
<m_collisionFlags type="int"> 0 </m_collisionFlags>
<m_islandTag1 type="int"> 4 </m_islandTag1>
<m_companionId type="int"> -1 </m_companionId>
<m_activationState1 type="int"> 1 </m_activationState1>
<m_internalType type="int"> 2 </m_internalType>
<m_checkCollideWith type="int"> 0 </m_checkCollideWith>
<m_padding type="char" count=4> -51 -51 -51 -51 </m_padding>
</m_collisionObjectData>
<m_invInertiaTensorWorld type="btMatrix3x3FloatData">
<m_el type="btVector3FloatData" count=3>
<m_floats type="float" count=4> 1.500000 0.000000 0.000000 0.000000 </m_floats>
<m_floats type="float" count=4> 0.000000 1.500000 0.000000 0.000000 </m_floats>
<m_floats type="float" count=4> 0.000000 0.000000 1.500000 0.000000 </m_floats>
</m_el>
</m_invInertiaTensorWorld>
<m_linearVelocity type="btVector3FloatData">
<m_floats type="float" count=4> 0.000000 -4.000000 0.000000 0.000000 </m_floats>
</m_linearVelocity>
<m_angularVelocity type="btVector3FloatData">
<m_floats type="float" count=4> 0.000000 0.000000 0.000000 0.000000 </m_floats>
</m_angularVelocity>
<m_angularFactor type="btVector3FloatData">
<m_floats type="float" count=4> 1.000000 1.000000 1.000000 0.000000 </m_floats>
</m_angularFactor>
<m_linearFactor type="btVector3FloatData">
<m_floats type="float" count=4> 1.000000 1.000000 1.000000 0.000000 </m_floats>
</m_linearFactor>
<m_gravity type="btVector3FloatData">
<m_floats type="float" count=4> 0.000000 -10.000000 0.000000 0.000000 </m_floats>
</m_gravity>
<m_gravity_acceleration type="btVector3FloatData">
<m_floats type="float" count=4> 0.000000 -10.000000 0.000000 0.000000 </m_floats>
</m_gravity_acceleration>
<m_invInertiaLocal type="btVector3FloatData">
<m_floats type="float" count=4> 1.500000 1.500000 1.500000 0.000000 </m_floats>
</m_invInertiaLocal>
<m_totalForce type="btVector3FloatData">
<m_floats type="float" count=4> 0.000000 0.000000 0.000000 0.000000 </m_floats>
</m_totalForce>
<m_totalTorque type="btVector3FloatData">
<m_floats type="float" count=4> 0.000000 0.000000 0.000000 0.000000 </m_floats>
</m_totalTorque>
<m_inverseMass type="float"> 1.000000 </m_inverseMass>
<m_linearDamping type="float"> 0.000000 </m_linearDamping>
<m_angularDamping type="float"> 0.000000 </m_angularDamping>
<m_additionalDampingFactor type="float"> 0.005000 </m_additionalDampingFactor>
<m_additionalLinearDampingThresholdSqr type="float"> 0.010000 </m_additionalLinearDampingThresholdSqr>
<m_additionalAngularDampingThresholdSqr type="float"> 0.010000 </m_additionalAngularDampingThresholdSqr>
<m_additionalAngularDampingFactor type="float"> 0.010000 </m_additionalAngularDampingFactor>
<m_linearSleepingThreshold type="float"> 0.800000 </m_linearSleepingThreshold>
<m_angularSleepingThreshold type="float"> 1.000000 </m_angularSleepingThreshold>
<m_additionalDamping type="int"> 0 </m_additionalDamping>
</btRigidBodyFloatData>
<btRigidBodyFloatData pointer=7>
<m_collisionObjectData type="btCollisionObjectFloatData">
<m_broadphaseHandle type="pointer"> 0 </m_broadphaseHandle>
<m_collisionShape type="pointer"> 5 </m_collisionShape>
<m_rootCollisionShape type="pointer"> 0 </m_rootCollisionShape>
<m_name type="pointer"> 0 </m_name>
<m_worldTransform type="btTransformFloatData">
<m_basis type="btMatrix3x3FloatData">
<m_el type="btVector3FloatData" count=3>
<m_floats type="float" count=4> 1.000000 0.000000 0.000000 0.000000 </m_floats>
<m_floats type="float" count=4> 0.000000 1.000000 0.000000 0.000000 </m_floats>
<m_floats type="float" count=4> 0.000000 0.000000 1.000000 0.000000 </m_floats>
</m_el>
</m_basis>
<m_origin type="btVector3FloatData">
<m_floats type="float" count=4> -5.000000 16.166668 -3.000000 0.000000 </m_floats>
</m_origin>
</m_worldTransform>
<m_interpolationWorldTransform type="btTransformFloatData">
<m_basis type="btMatrix3x3FloatData">
<m_el type="btVector3FloatData" count=3>
<m_floats type="float" count=4> 1.000000 0.000000 0.000000 0.000000 </m_floats>
<m_floats type="float" count=4> 0.000000 1.000000 0.000000 0.000000 </m_floats>
<m_floats type="float" count=4> 0.000000 0.000000 1.000000 0.000000 </m_floats>
</m_el>
</m_basis>
<m_origin type="btVector3FloatData">
<m_floats type="float" count=4> -5.000000 16.166668 -3.000000 0.000000 </m_floats>
</m_origin>
</m_interpolationWorldTransform>
<m_interpolationLinearVelocity type="btVector3FloatData">
<m_floats type="float" count=4> 0.000000 -4.000000 0.000000 0.000000 </m_floats>
</m_interpolationLinearVelocity>
<m_interpolationAngularVelocity type="btVector3FloatData">
<m_floats type="float" count=4> 0.000000 0.000000 0.000000 0.000000 </m_floats>
</m_interpolationAngularVelocity>
<m_anisotropicFriction type="btVector3FloatData">
<m_floats type="float" count=4> 1.000000 1.000000 1.000000 0.000000 </m_floats>
</m_anisotropicFriction>
<m_contactProcessingThreshold type="float"> 999999984306749440.000000 </m_contactProcessingThreshold>
<m_deactivationTime type="float"> 0.000000 </m_deactivationTime>
<m_friction type="float"> 0.500000 </m_friction>
<m_rollingFriction type="float"> -431602080.000000 </m_rollingFriction>
<m_restitution type="float"> 0.000000 </m_restitution>
<m_hitFraction type="float"> 1.000000 </m_hitFraction>
<m_ccdSweptSphereRadius type="float"> 0.000000 </m_ccdSweptSphereRadius>
<m_ccdMotionThreshold type="float"> 0.000000 </m_ccdMotionThreshold>
<m_hasAnisotropicFriction type="int"> 0 </m_hasAnisotropicFriction>
<m_collisionFlags type="int"> 0 </m_collisionFlags>
<m_islandTag1 type="int"> 4 </m_islandTag1>
<m_companionId type="int"> -1 </m_companionId>
<m_activationState1 type="int"> 1 </m_activationState1>
<m_internalType type="int"> 2 </m_internalType>
<m_checkCollideWith type="int"> 0 </m_checkCollideWith>
<m_padding type="char" count=4> -51 -51 -51 -51 </m_padding>
</m_collisionObjectData>
<m_invInertiaTensorWorld type="btMatrix3x3FloatData">
<m_el type="btVector3FloatData" count=3>
<m_floats type="float" count=4> 1.500000 0.000000 0.000000 0.000000 </m_floats>
<m_floats type="float" count=4> 0.000000 1.500000 0.000000 0.000000 </m_floats>
<m_floats type="float" count=4> 0.000000 0.000000 1.500000 0.000000 </m_floats>
</m_el>
</m_invInertiaTensorWorld>
<m_linearVelocity type="btVector3FloatData">
<m_floats type="float" count=4> 0.000000 -4.000000 0.000000 0.000000 </m_floats>
</m_linearVelocity>
<m_angularVelocity type="btVector3FloatData">
<m_floats type="float" count=4> 0.000000 0.000000 0.000000 0.000000 </m_floats>
</m_angularVelocity>
<m_angularFactor type="btVector3FloatData">
<m_floats type="float" count=4> 1.000000 1.000000 1.000000 0.000000 </m_floats>
</m_angularFactor>
<m_linearFactor type="btVector3FloatData">
<m_floats type="float" count=4> 1.000000 1.000000 1.000000 0.000000 </m_floats>
</m_linearFactor>
<m_gravity type="btVector3FloatData">
<m_floats type="float" count=4> 0.000000 -10.000000 0.000000 0.000000 </m_floats>
</m_gravity>
<m_gravity_acceleration type="btVector3FloatData">
<m_floats type="float" count=4> 0.000000 -10.000000 0.000000 0.000000 </m_floats>
</m_gravity_acceleration>
<m_invInertiaLocal type="btVector3FloatData">
<m_floats type="float" count=4> 1.500000 1.500000 1.500000 0.000000 </m_floats>
</m_invInertiaLocal>
<m_totalForce type="btVector3FloatData">
<m_floats type="float" count=4> 0.000000 0.000000 0.000000 0.000000 </m_floats>
</m_totalForce>
<m_totalTorque type="btVector3FloatData">
<m_floats type="float" count=4> 0.000000 0.000000 0.000000 0.000000 </m_floats>
</m_totalTorque>
<m_inverseMass type="float"> 1.000000 </m_inverseMass>
<m_linearDamping type="float"> 0.000000 </m_linearDamping>
<m_angularDamping type="float"> 0.000000 </m_angularDamping>
<m_additionalDampingFactor type="float"> 0.005000 </m_additionalDampingFactor>
<m_additionalLinearDampingThresholdSqr type="float"> 0.010000 </m_additionalLinearDampingThresholdSqr>
<m_additionalAngularDampingThresholdSqr type="float"> 0.010000 </m_additionalAngularDampingThresholdSqr>
<m_additionalAngularDampingFactor type="float"> 0.010000 </m_additionalAngularDampingFactor>
<m_linearSleepingThreshold type="float"> 0.800000 </m_linearSleepingThreshold>
<m_angularSleepingThreshold type="float"> 1.000000 </m_angularSleepingThreshold>
<m_additionalDamping type="int"> 0 </m_additionalDamping>
</btRigidBodyFloatData>
<btRigidBodyFloatData pointer=8>
<m_collisionObjectData type="btCollisionObjectFloatData">
<m_broadphaseHandle type="pointer"> 0 </m_broadphaseHandle>
<m_collisionShape type="pointer"> 5 </m_collisionShape>
<m_rootCollisionShape type="pointer"> 0 </m_rootCollisionShape>
<m_name type="pointer"> 0 </m_name>
<m_worldTransform type="btTransformFloatData">
<m_basis type="btMatrix3x3FloatData">
<m_el type="btVector3FloatData" count=3>
<m_floats type="float" count=4> 1.000000 0.000000 0.000000 0.000000 </m_floats>
<m_floats type="float" count=4> 0.000000 1.000000 0.000000 0.000000 </m_floats>
<m_floats type="float" count=4> 0.000000 0.000000 1.000000 0.000000 </m_floats>
</m_el>
</m_basis>
<m_origin type="btVector3FloatData">
<m_floats type="float" count=4> -5.000000 18.166668 -3.000000 0.000000 </m_floats>
</m_origin>
</m_worldTransform>
<m_interpolationWorldTransform type="btTransformFloatData">
<m_basis type="btMatrix3x3FloatData">
<m_el type="btVector3FloatData" count=3>
<m_floats type="float" count=4> 1.000000 0.000000 0.000000 0.000000 </m_floats>
<m_floats type="float" count=4> 0.000000 1.000000 0.000000 0.000000 </m_floats>
<m_floats type="float" count=4> 0.000000 0.000000 1.000000 0.000000 </m_floats>
</m_el>
</m_basis>
<m_origin type="btVector3FloatData">
<m_floats type="float" count=4> -5.000000 18.166668 -3.000000 0.000000 </m_floats>
</m_origin>
</m_interpolationWorldTransform>
<m_interpolationLinearVelocity type="btVector3FloatData">
<m_floats type="float" count=4> 0.000000 -4.000000 0.000000 0.000000 </m_floats>
</m_interpolationLinearVelocity>
<m_interpolationAngularVelocity type="btVector3FloatData">
<m_floats type="float" count=4> 0.000000 0.000000 0.000000 0.000000 </m_floats>
</m_interpolationAngularVelocity>
<m_anisotropicFriction type="btVector3FloatData">
<m_floats type="float" count=4> 1.000000 1.000000 1.000000 0.000000 </m_floats>
</m_anisotropicFriction>
<m_contactProcessingThreshold type="float"> 999999984306749440.000000 </m_contactProcessingThreshold>
<m_deactivationTime type="float"> 0.000000 </m_deactivationTime>
<m_friction type="float"> 0.500000 </m_friction>
<m_rollingFriction type="float"> -431602080.000000 </m_rollingFriction>
<m_restitution type="float"> 0.000000 </m_restitution>
<m_hitFraction type="float"> 1.000000 </m_hitFraction>
<m_ccdSweptSphereRadius type="float"> 0.000000 </m_ccdSweptSphereRadius>
<m_ccdMotionThreshold type="float"> 0.000000 </m_ccdMotionThreshold>
<m_hasAnisotropicFriction type="int"> 0 </m_hasAnisotropicFriction>
<m_collisionFlags type="int"> 0 </m_collisionFlags>
<m_islandTag1 type="int"> 4 </m_islandTag1>
<m_companionId type="int"> -1 </m_companionId>
<m_activationState1 type="int"> 1 </m_activationState1>
<m_internalType type="int"> 2 </m_internalType>
<m_checkCollideWith type="int"> 0 </m_checkCollideWith>
<m_padding type="char" count=4> -51 -51 -51 -51 </m_padding>
</m_collisionObjectData>
<m_invInertiaTensorWorld type="btMatrix3x3FloatData">
<m_el type="btVector3FloatData" count=3>
<m_floats type="float" count=4> 1.500000 0.000000 0.000000 0.000000 </m_floats>
<m_floats type="float" count=4> 0.000000 1.500000 0.000000 0.000000 </m_floats>
<m_floats type="float" count=4> 0.000000 0.000000 1.500000 0.000000 </m_floats>
</m_el>
</m_invInertiaTensorWorld>
<m_linearVelocity type="btVector3FloatData">
<m_floats type="float" count=4> 0.000000 -4.000000 0.000000 0.000000 </m_floats>
</m_linearVelocity>
<m_angularVelocity type="btVector3FloatData">
<m_floats type="float" count=4> 0.000000 0.000000 0.000000 0.000000 </m_floats>
</m_angularVelocity>
<m_angularFactor type="btVector3FloatData">
<m_floats type="float" count=4> 1.000000 1.000000 1.000000 0.000000 </m_floats>
</m_angularFactor>
<m_linearFactor type="btVector3FloatData">
<m_floats type="float" count=4> 1.000000 1.000000 1.000000 0.000000 </m_floats>
</m_linearFactor>
<m_gravity type="btVector3FloatData">
<m_floats type="float" count=4> 0.000000 -10.000000 0.000000 0.000000 </m_floats>
</m_gravity>
<m_gravity_acceleration type="btVector3FloatData">
<m_floats type="float" count=4> 0.000000 -10.000000 0.000000 0.000000 </m_floats>
</m_gravity_acceleration>
<m_invInertiaLocal type="btVector3FloatData">
<m_floats type="float" count=4> 1.500000 1.500000 1.500000 0.000000 </m_floats>
</m_invInertiaLocal>
<m_totalForce type="btVector3FloatData">
<m_floats type="float" count=4> 0.000000 0.000000 0.000000 0.000000 </m_floats>
</m_totalForce>
<m_totalTorque type="btVector3FloatData">
<m_floats type="float" count=4> 0.000000 0.000000 0.000000 0.000000 </m_floats>
</m_totalTorque>
<m_inverseMass type="float"> 1.000000 </m_inverseMass>
<m_linearDamping type="float"> 0.000000 </m_linearDamping>
<m_angularDamping type="float"> 0.000000 </m_angularDamping>
<m_additionalDampingFactor type="float"> 0.005000 </m_additionalDampingFactor>
<m_additionalLinearDampingThresholdSqr type="float"> 0.010000 </m_additionalLinearDampingThresholdSqr>
<m_additionalAngularDampingThresholdSqr type="float"> 0.010000 </m_additionalAngularDampingThresholdSqr>
<m_additionalAngularDampingFactor type="float"> 0.010000 </m_additionalAngularDampingFactor>
<m_linearSleepingThreshold type="float"> 0.800000 </m_linearSleepingThreshold>
<m_angularSleepingThreshold type="float"> 1.000000 </m_angularSleepingThreshold>
<m_additionalDamping type="int"> 0 </m_additionalDamping>
</btRigidBodyFloatData>
<btRigidBodyFloatData pointer=9>
<m_collisionObjectData type="btCollisionObjectFloatData">
<m_broadphaseHandle type="pointer"> 0 </m_broadphaseHandle>
<m_collisionShape type="pointer"> 5 </m_collisionShape>
<m_rootCollisionShape type="pointer"> 0 </m_rootCollisionShape>
<m_name type="pointer"> 0 </m_name>
<m_worldTransform type="btTransformFloatData">
<m_basis type="btMatrix3x3FloatData">
<m_el type="btVector3FloatData" count=3>
<m_floats type="float" count=4> 1.000000 0.000000 0.000000 0.000000 </m_floats>
<m_floats type="float" count=4> 0.000000 1.000000 0.000000 0.000000 </m_floats>
<m_floats type="float" count=4> 0.000000 0.000000 1.000000 0.000000 </m_floats>
</m_el>
</m_basis>
<m_origin type="btVector3FloatData">
<m_floats type="float" count=4> -5.000000 20.166668 -3.000000 0.000000 </m_floats>
</m_origin>
</m_worldTransform>
<m_interpolationWorldTransform type="btTransformFloatData">
<m_basis type="btMatrix3x3FloatData">
<m_el type="btVector3FloatData" count=3>
<m_floats type="float" count=4> 1.000000 0.000000 0.000000 0.000000 </m_floats>
<m_floats type="float" count=4> 0.000000 1.000000 0.000000 0.000000 </m_floats>
<m_floats type="float" count=4> 0.000000 0.000000 1.000000 0.000000 </m_floats>
</m_el>
</m_basis>
<m_origin type="btVector3FloatData">
<m_floats type="float" count=4> -5.000000 20.166668 -3.000000 0.000000 </m_floats>
</m_origin>
</m_interpolationWorldTransform>
<m_interpolationLinearVelocity type="btVector3FloatData">
<m_floats type="float" count=4> 0.000000 -4.000000 0.000000 0.000000 </m_floats>
</m_interpolationLinearVelocity>
<m_interpolationAngularVelocity type="btVector3FloatData">
<m_floats type="float" count=4> 0.000000 0.000000 0.000000 0.000000 </m_floats>
</m_interpolationAngularVelocity>
<m_anisotropicFriction type="btVector3FloatData">
<m_floats type="float" count=4> 1.000000 1.000000 1.000000 0.000000 </m_floats>
</m_anisotropicFriction>
<m_contactProcessingThreshold type="float"> 999999984306749440.000000 </m_contactProcessingThreshold>
<m_deactivationTime type="float"> 0.000000 </m_deactivationTime>
<m_friction type="float"> 0.500000 </m_friction>
<m_rollingFriction type="float"> -431602080.000000 </m_rollingFriction>
<m_restitution type="float"> 0.000000 </m_restitution>
<m_hitFraction type="float"> 1.000000 </m_hitFraction>
<m_ccdSweptSphereRadius type="float"> 0.000000 </m_ccdSweptSphereRadius>
<m_ccdMotionThreshold type="float"> 0.000000 </m_ccdMotionThreshold>
<m_hasAnisotropicFriction type="int"> 0 </m_hasAnisotropicFriction>
<m_collisionFlags type="int"> 0 </m_collisionFlags>
<m_islandTag1 type="int"> 4 </m_islandTag1>
<m_companionId type="int"> -1 </m_companionId>
<m_activationState1 type="int"> 1 </m_activationState1>
<m_internalType type="int"> 2 </m_internalType>
<m_checkCollideWith type="int"> 0 </m_checkCollideWith>
<m_padding type="char" count=4> -51 -51 -51 -51 </m_padding>
</m_collisionObjectData>
<m_invInertiaTensorWorld type="btMatrix3x3FloatData">
<m_el type="btVector3FloatData" count=3>
<m_floats type="float" count=4> 1.500000 0.000000 0.000000 0.000000 </m_floats>
<m_floats type="float" count=4> 0.000000 1.500000 0.000000 0.000000 </m_floats>
<m_floats type="float" count=4> 0.000000 0.000000 1.500000 0.000000 </m_floats>
</m_el>
</m_invInertiaTensorWorld>
<m_linearVelocity type="btVector3FloatData">
<m_floats type="float" count=4> 0.000000 -4.000000 0.000000 0.000000 </m_floats>
</m_linearVelocity>
<m_angularVelocity type="btVector3FloatData">
<m_floats type="float" count=4> 0.000000 0.000000 0.000000 0.000000 </m_floats>
</m_angularVelocity>
<m_angularFactor type="btVector3FloatData">
<m_floats type="float" count=4> 1.000000 1.000000 1.000000 0.000000 </m_floats>
</m_angularFactor>
<m_linearFactor type="btVector3FloatData">
<m_floats type="float" count=4> 1.000000 1.000000 1.000000 0.000000 </m_floats>
</m_linearFactor>
<m_gravity type="btVector3FloatData">
<m_floats type="float" count=4> 0.000000 -10.000000 0.000000 0.000000 </m_floats>
</m_gravity>
<m_gravity_acceleration type="btVector3FloatData">
<m_floats type="float" count=4> 0.000000 -10.000000 0.000000 0.000000 </m_floats>
</m_gravity_acceleration>
<m_invInertiaLocal type="btVector3FloatData">
<m_floats type="float" count=4> 1.500000 1.500000 1.500000 0.000000 </m_floats>
</m_invInertiaLocal>
<m_totalForce type="btVector3FloatData">
<m_floats type="float" count=4> 0.000000 0.000000 0.000000 0.000000 </m_floats>
</m_totalForce>
<m_totalTorque type="btVector3FloatData">
<m_floats type="float" count=4> 0.000000 0.000000 0.000000 0.000000 </m_floats>
</m_totalTorque>
<m_inverseMass type="float"> 1.000000 </m_inverseMass>
<m_linearDamping type="float"> 0.000000 </m_linearDamping>
<m_angularDamping type="float"> 0.000000 </m_angularDamping>
<m_additionalDampingFactor type="float"> 0.005000 </m_additionalDampingFactor>
<m_additionalLinearDampingThresholdSqr type="float"> 0.010000 </m_additionalLinearDampingThresholdSqr>
<m_additionalAngularDampingThresholdSqr type="float"> 0.010000 </m_additionalAngularDampingThresholdSqr>
<m_additionalAngularDampingFactor type="float"> 0.010000 </m_additionalAngularDampingFactor>
<m_linearSleepingThreshold type="float"> 0.800000 </m_linearSleepingThreshold>
<m_angularSleepingThreshold type="float"> 1.000000 </m_angularSleepingThreshold>
<m_additionalDamping type="int"> 0 </m_additionalDamping>
</btRigidBodyFloatData>
<btRigidBodyFloatData pointer=10>
<m_collisionObjectData type="btCollisionObjectFloatData">
<m_broadphaseHandle type="pointer"> 0 </m_broadphaseHandle>
<m_collisionShape type="pointer"> 5 </m_collisionShape>
<m_rootCollisionShape type="pointer"> 0 </m_rootCollisionShape>
<m_name type="pointer"> 0 </m_name>
<m_worldTransform type="btTransformFloatData">
<m_basis type="btMatrix3x3FloatData">
<m_el type="btVector3FloatData" count=3>
<m_floats type="float" count=4> 1.000000 0.000000 0.000000 0.000000 </m_floats>
<m_floats type="float" count=4> 0.000000 1.000000 0.000000 0.000000 </m_floats>
<m_floats type="float" count=4> 0.000000 0.000000 1.000000 0.000000 </m_floats>
</m_el>
</m_basis>
<m_origin type="btVector3FloatData">
<m_floats type="float" count=4> -5.000000 22.166668 -3.000000 0.000000 </m_floats>
</m_origin>
</m_worldTransform>
<m_interpolationWorldTransform type="btTransformFloatData">
<m_basis type="btMatrix3x3FloatData">
<m_el type="btVector3FloatData" count=3>
<m_floats type="float" count=4> 1.000000 0.000000 0.000000 0.000000 </m_floats>
<m_floats type="float" count=4> 0.000000 1.000000 0.000000 0.000000 </m_floats>
<m_floats type="float" count=4> 0.000000 0.000000 1.000000 0.000000 </m_floats>
</m_el>
</m_basis>
<m_origin type="btVector3FloatData">
<m_floats type="float" count=4> -5.000000 22.166668 -3.000000 0.000000 </m_floats>
</m_origin>
</m_interpolationWorldTransform>
<m_interpolationLinearVelocity type="btVector3FloatData">
<m_floats type="float" count=4> 0.000000 -4.000000 0.000000 0.000000 </m_floats>
</m_interpolationLinearVelocity>
<m_interpolationAngularVelocity type="btVector3FloatData">
<m_floats type="float" count=4> 0.000000 0.000000 0.000000 0.000000 </m_floats>
</m_interpolationAngularVelocity>
<m_anisotropicFriction type="btVector3FloatData">
<m_floats type="float" count=4> 1.000000 1.000000 1.000000 0.000000 </m_floats>
</m_anisotropicFriction>
<m_contactProcessingThreshold type="float"> 999999984306749440.000000 </m_contactProcessingThreshold>
<m_deactivationTime type="float"> 0.000000 </m_deactivationTime>
<m_friction type="float"> 0.500000 </m_friction>
<m_rollingFriction type="float"> -431602080.000000 </m_rollingFriction>
<m_restitution type="float"> 0.000000 </m_restitution>
<m_hitFraction type="float"> 1.000000 </m_hitFraction>
<m_ccdSweptSphereRadius type="float"> 0.000000 </m_ccdSweptSphereRadius>
<m_ccdMotionThreshold type="float"> 0.000000 </m_ccdMotionThreshold>
<m_hasAnisotropicFriction type="int"> 0 </m_hasAnisotropicFriction>
<m_collisionFlags type="int"> 0 </m_collisionFlags>
<m_islandTag1 type="int"> 4 </m_islandTag1>
<m_companionId type="int"> -1 </m_companionId>
<m_activationState1 type="int"> 1 </m_activationState1>
<m_internalType type="int"> 2 </m_internalType>
<m_checkCollideWith type="int"> 0 </m_checkCollideWith>
<m_padding type="char" count=4> -51 -51 -51 -51 </m_padding>
</m_collisionObjectData>
<m_invInertiaTensorWorld type="btMatrix3x3FloatData">
<m_el type="btVector3FloatData" count=3>
<m_floats type="float" count=4> 1.500000 0.000000 0.000000 0.000000 </m_floats>
<m_floats type="float" count=4> 0.000000 1.500000 0.000000 0.000000 </m_floats>
<m_floats type="float" count=4> 0.000000 0.000000 1.500000 0.000000 </m_floats>
</m_el>
</m_invInertiaTensorWorld>
<m_linearVelocity type="btVector3FloatData">
<m_floats type="float" count=4> 0.000000 -4.000000 0.000000 0.000000 </m_floats>
</m_linearVelocity>
<m_angularVelocity type="btVector3FloatData">
<m_floats type="float" count=4> 0.000000 0.000000 0.000000 0.000000 </m_floats>
</m_angularVelocity>
<m_angularFactor type="btVector3FloatData">
<m_floats type="float" count=4> 1.000000 1.000000 1.000000 0.000000 </m_floats>
</m_angularFactor>
<m_linearFactor type="btVector3FloatData">
<m_floats type="float" count=4> 1.000000 1.000000 1.000000 0.000000 </m_floats>
</m_linearFactor>
<m_gravity type="btVector3FloatData">
<m_floats type="float" count=4> 0.000000 -10.000000 0.000000 0.000000 </m_floats>
</m_gravity>
<m_gravity_acceleration type="btVector3FloatData">
<m_floats type="float" count=4> 0.000000 -10.000000 0.000000 0.000000 </m_floats>
</m_gravity_acceleration>
<m_invInertiaLocal type="btVector3FloatData">
<m_floats type="float" count=4> 1.500000 1.500000 1.500000 0.000000 </m_floats>
</m_invInertiaLocal>
<m_totalForce type="btVector3FloatData">
<m_floats type="float" count=4> 0.000000 0.000000 0.000000 0.000000 </m_floats>
</m_totalForce>
<m_totalTorque type="btVector3FloatData">
<m_floats type="float" count=4> 0.000000 0.000000 0.000000 0.000000 </m_floats>
</m_totalTorque>
<m_inverseMass type="float"> 1.000000 </m_inverseMass>
<m_linearDamping type="float"> 0.000000 </m_linearDamping>
<m_angularDamping type="float"> 0.000000 </m_angularDamping>
<m_additionalDampingFactor type="float"> 0.005000 </m_additionalDampingFactor>
<m_additionalLinearDampingThresholdSqr type="float"> 0.010000 </m_additionalLinearDampingThresholdSqr>
<m_additionalAngularDampingThresholdSqr type="float"> 0.010000 </m_additionalAngularDampingThresholdSqr>
<m_additionalAngularDampingFactor type="float"> 0.010000 </m_additionalAngularDampingFactor>
<m_linearSleepingThreshold type="float"> 0.800000 </m_linearSleepingThreshold>
<m_angularSleepingThreshold type="float"> 1.000000 </m_angularSleepingThreshold>
<m_additionalDamping type="int"> 0 </m_additionalDamping>
</btRigidBodyFloatData>
<btConvexInternalShapeData pointer=3>
<m_collisionShapeData type="btCollisionShapeData">
<m_name type="pointer"> 0 </m_name>
<m_shapeType type="int"> 0 </m_shapeType>
<m_padding type="char" count=4> -51 -51 -51 -51 </m_padding>
</m_collisionShapeData>
<m_localScaling type="btVector3FloatData">
<m_floats type="float" count=4> 1.000000 1.000000 1.000000 0.000000 </m_floats>
</m_localScaling>
<m_implicitShapeDimensions type="btVector3FloatData">
<m_floats type="float" count=4> 49.959999 49.959999 49.959999 0.000000 </m_floats>
</m_implicitShapeDimensions>
<m_collisionMargin type="float"> 0.040000 </m_collisionMargin>
<m_padding type="int"> -842150451 </m_padding>
</btConvexInternalShapeData>
<btConvexInternalShapeData pointer=5>
<m_collisionShapeData type="btCollisionShapeData">
<m_name type="pointer"> 0 </m_name>
<m_shapeType type="int"> 0 </m_shapeType>
<m_padding type="char" count=4> -51 -51 -51 -51 </m_padding>
</m_collisionShapeData>
<m_localScaling type="btVector3FloatData">
<m_floats type="float" count=4> 1.000000 1.000000 1.000000 0.000000 </m_floats>
</m_localScaling>
<m_implicitShapeDimensions type="btVector3FloatData">
<m_floats type="float" count=4> 0.960000 0.960000 0.960000 0.000000 </m_floats>
</m_implicitShapeDimensions>
<m_collisionMargin type="float"> 0.040000 </m_collisionMargin>
<m_padding type="int"> -842150451 </m_padding>
</btConvexInternalShapeData>
</bullet_physics>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,109 @@
/*
Bullet Continuous Collision Detection and Physics Library
Copyright (c) 2003-2007 Erwin Coumans http://continuousphysics.com/Bullet/
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.
*/
#include "BulletXmlImportDemo.h"
#include "GlutStuff.h"
#include "GLDebugDrawer.h"
#include "btBulletDynamicsCommon.h"
#include "LinearMath/btHashMap.h"
#ifdef USE_AMD_OPENCL
#include "btOpenCLUtils.h"
#include <LinearMath/btScalar.h>
cl_context g_cxMainContext;
cl_device_id g_cdDevice;
cl_command_queue g_cqCommandQue;
// Returns true if OpenCL is initialized properly, false otherwise.
bool initCL( void* glCtx, void* glDC )
{
const char* vendorSDK = btOpenCLUtils::getSdkVendorName();
printf("This program was compiled using the %s OpenCL SDK\n",vendorSDK);
int ciErrNum = 0;
#ifdef BT_USE_CLEW
ciErrNum = clewInit( "OpenCL.dll" );
if ( ciErrNum != CLEW_SUCCESS ) {
return false;
}
#endif
#if defined(CL_PLATFORM_MINI_CL)
cl_device_type deviceType = CL_DEVICE_TYPE_CPU;
#elif defined(CL_PLATFORM_AMD)
cl_device_type deviceType = CL_DEVICE_TYPE_GPU;
#elif defined(CL_PLATFORM_NVIDIA)
cl_device_type deviceType = CL_DEVICE_TYPE_GPU;
#else
cl_device_type deviceType = CL_DEVICE_TYPE_CPU;
#endif
g_cxMainContext = btOpenCLUtils::createContextFromType(deviceType, &ciErrNum, glCtx, glDC);
oclCHECKERROR(ciErrNum, CL_SUCCESS);
int numDev = btOpenCLUtils::getNumDevices(g_cxMainContext);
if (!numDev)
return false;
g_cdDevice = btOpenCLUtils::getDevice(g_cxMainContext,0);
btOpenCLDeviceInfo clInfo;
btOpenCLUtils::getDeviceInfo(g_cdDevice,clInfo);
btOpenCLUtils::printDeviceInfo(g_cdDevice);
// create a command-queue
g_cqCommandQue = clCreateCommandQueue(g_cxMainContext, g_cdDevice, 0, &ciErrNum);
oclCHECKERROR(ciErrNum, CL_SUCCESS);
return true;
}
#endif //#ifdef USE_AMD_OPENCL
int main(int argc,char** argv)
{
GLDebugDrawer gDebugDrawer;
#ifdef USE_AMD_OPENCL
bool initialized = initCL(0,0);
btAssert(initialized);
#endif //USE_AMD_OPENCL
BulletXmlImportDemo serializeDemo;
serializeDemo.initPhysics();
serializeDemo.getDynamicsWorld()->setDebugDrawer(&gDebugDrawer);
#ifdef CHECK_MEMORY_LEAKS
serializeDemo.exitPhysics();
#else
return glutmain(argc, argv,640,480,"Bullet Physics Demo. http://bulletphysics.org",&serializeDemo);
#endif
//default glut doesn't return from mainloop
return 0;
}

View File

@ -64,6 +64,8 @@ typedef struct bInvalidHandle {
class btConvexHullShapeData;
class btCollisionObjectDoubleData;
class btCollisionObjectFloatData;
class btDynamicsWorldDoubleData;
class btDynamicsWorldFloatData;
class btRigidBodyFloatData;
class btRigidBodyDoubleData;
class btConstraintInfo1;
@ -76,6 +78,8 @@ typedef struct bInvalidHandle {
class btGeneric6DofConstraintData;
class btGeneric6DofSpringConstraintData;
class btSliderConstraintData;
class btContactSolverInfoDoubleData;
class btContactSolverInfoFloatData;
class SoftBodyMaterialData;
class SoftBodyNodeData;
class SoftBodyLinkData;
@ -503,6 +507,7 @@ typedef struct bInvalidHandle {
double m_contactProcessingThreshold;
double m_deactivationTime;
double m_friction;
double m_rollingFriction;
double m_restitution;
double m_hitFraction;
double m_ccdSweptSphereRadius;
@ -534,6 +539,7 @@ typedef struct bInvalidHandle {
float m_contactProcessingThreshold;
float m_deactivationTime;
float m_friction;
float m_rollingFriction;
float m_restitution;
float m_hitFraction;
float m_ccdSweptSphereRadius;
@ -545,6 +551,25 @@ typedef struct bInvalidHandle {
int m_activationState1;
int m_internalType;
int m_checkCollideWith;
char m_padding[4];
};
// -------------------------------------------------- //
class btDynamicsWorldDoubleData
{
public:
btContactSolverInfoDoubleData m_solverInfo;
btVector3DoubleData m_gravity;
};
// -------------------------------------------------- //
class btDynamicsWorldFloatData
{
public:
btContactSolverInfoFloatData m_solverInfo;
btVector3FloatData m_gravity;
};
@ -628,7 +653,9 @@ typedef struct bInvalidHandle {
float m_appliedImpulse;
float m_dbgDrawSize;
int m_disableCollisionsBetweenLinkedBodies;
char m_pad4[4];
int m_overrideNumSolverIterations;
float m_breakingImpulseThreshold;
int m_isEnabled;
};
@ -754,6 +781,64 @@ typedef struct bInvalidHandle {
};
// -------------------------------------------------- //
class btContactSolverInfoDoubleData
{
public:
double m_tau;
double m_damping;
double m_friction;
double m_timeStep;
double m_restitution;
double m_maxErrorReduction;
double m_sor;
double m_erp;
double m_erp2;
double m_globalCfm;
double m_splitImpulsePenetrationThreshold;
double m_splitImpulseTurnErp;
double m_linearSlop;
double m_warmstartingFactor;
double m_maxGyroscopicForce;
double m_singleAxisRollingFrictionThreshold;
int m_numIterations;
int m_solverMode;
int m_restingContactRestitutionThreshold;
int m_minimumSolverBatchSize;
int m_splitImpulse;
char m_padding[4];
};
// -------------------------------------------------- //
class btContactSolverInfoFloatData
{
public:
float m_tau;
float m_damping;
float m_friction;
float m_timeStep;
float m_restitution;
float m_maxErrorReduction;
float m_sor;
float m_erp;
float m_erp2;
float m_globalCfm;
float m_splitImpulsePenetrationThreshold;
float m_splitImpulseTurnErp;
float m_linearSlop;
float m_warmstartingFactor;
float m_maxGyroscopicForce;
float m_singleAxisRollingFrictionThreshold;
int m_numIterations;
int m_solverMode;
int m_restingContactRestitutionThreshold;
int m_minimumSolverBatchSize;
int m_splitImpulse;
char m_padding[4];
};
// -------------------------------------------------- //
class SoftBodyMaterialData
{

View File

@ -174,6 +174,11 @@ void btBulletFile::parseData()
m_rigidBodies.push_back((bStructHandle*) id);
}
if (dataChunk.code == BT_DYNAMICSWORLD_CODE)
{
m_dynamicsWorldInfo.push_back((bStructHandle*) id);
}
if (dataChunk.code == BT_CONSTRAINT_CODE)
{
m_constraints.push_back((bStructHandle*) id);

View File

@ -51,7 +51,9 @@ namespace bParse {
btAlignedObjectArray<bStructHandle*> m_bvhs;
btAlignedObjectArray<bStructHandle*> m_triangleInfoMaps;
btAlignedObjectArray<bStructHandle*> m_dynamicsWorldInfo;
btAlignedObjectArray<char*> m_dataBlocks;
btBulletFile();

View File

@ -133,7 +133,82 @@ bool btBulletWorldImporter::convertAllObjects( bParse::btBulletFile* bulletFile
for (int i=0;i<bulletFile2->m_dynamicsWorldInfo.size();i++)
{
if (bulletFile2->getFlags() & bParse::FD_DOUBLE_PRECISION)
{
btDynamicsWorldDoubleData* solverInfoData = (btDynamicsWorldDoubleData*)bulletFile2->m_dynamicsWorldInfo[i];
btContactSolverInfo solverInfo;
btVector3 gravity;
gravity.deSerializeDouble(solverInfoData->m_gravity);
solverInfo.m_tau = solverInfoData->m_solverInfo.m_tau;
solverInfo.m_damping = solverInfoData->m_solverInfo.m_damping;
solverInfo.m_friction = solverInfoData->m_solverInfo.m_friction;
solverInfo.m_timeStep = solverInfoData->m_solverInfo.m_timeStep;
solverInfo.m_restitution = solverInfoData->m_solverInfo.m_restitution;
solverInfo.m_maxErrorReduction = solverInfoData->m_solverInfo.m_maxErrorReduction;
solverInfo.m_sor = solverInfoData->m_solverInfo.m_sor;
solverInfo.m_erp = solverInfoData->m_solverInfo.m_erp;
solverInfo.m_erp2 = solverInfoData->m_solverInfo.m_erp2;
solverInfo.m_globalCfm = solverInfoData->m_solverInfo.m_globalCfm;
solverInfo.m_splitImpulsePenetrationThreshold = solverInfoData->m_solverInfo.m_splitImpulsePenetrationThreshold;
solverInfo.m_splitImpulseTurnErp = solverInfoData->m_solverInfo.m_splitImpulseTurnErp;
solverInfo.m_linearSlop = solverInfoData->m_solverInfo.m_linearSlop;
solverInfo.m_warmstartingFactor = solverInfoData->m_solverInfo.m_warmstartingFactor;
solverInfo.m_maxGyroscopicForce = solverInfoData->m_solverInfo.m_maxGyroscopicForce;
solverInfo.m_singleAxisRollingFrictionThreshold = solverInfoData->m_solverInfo.m_singleAxisRollingFrictionThreshold;
solverInfo.m_numIterations = solverInfoData->m_solverInfo.m_numIterations;
solverInfo.m_solverMode = solverInfoData->m_solverInfo.m_solverMode;
solverInfo.m_restingContactRestitutionThreshold = solverInfoData->m_solverInfo.m_restingContactRestitutionThreshold;
solverInfo.m_minimumSolverBatchSize = solverInfoData->m_solverInfo.m_minimumSolverBatchSize;
solverInfo.m_splitImpulse = solverInfoData->m_solverInfo.m_splitImpulse;
setDynamicsWorldInfo(gravity,solverInfo);
} else
{
btDynamicsWorldFloatData* solverInfoData = (btDynamicsWorldFloatData*)bulletFile2->m_dynamicsWorldInfo[i];
btContactSolverInfo solverInfo;
btVector3 gravity;
gravity.deSerializeFloat(solverInfoData->m_gravity);
solverInfo.m_tau = solverInfoData->m_solverInfo.m_tau;
solverInfo.m_damping = solverInfoData->m_solverInfo.m_damping;
solverInfo.m_friction = solverInfoData->m_solverInfo.m_friction;
solverInfo.m_timeStep = solverInfoData->m_solverInfo.m_timeStep;
solverInfo.m_restitution = solverInfoData->m_solverInfo.m_restitution;
solverInfo.m_maxErrorReduction = solverInfoData->m_solverInfo.m_maxErrorReduction;
solverInfo.m_sor = solverInfoData->m_solverInfo.m_sor;
solverInfo.m_erp = solverInfoData->m_solverInfo.m_erp;
solverInfo.m_erp2 = solverInfoData->m_solverInfo.m_erp2;
solverInfo.m_globalCfm = solverInfoData->m_solverInfo.m_globalCfm;
solverInfo.m_splitImpulsePenetrationThreshold = solverInfoData->m_solverInfo.m_splitImpulsePenetrationThreshold;
solverInfo.m_splitImpulseTurnErp = solverInfoData->m_solverInfo.m_splitImpulseTurnErp;
solverInfo.m_linearSlop = solverInfoData->m_solverInfo.m_linearSlop;
solverInfo.m_warmstartingFactor = solverInfoData->m_solverInfo.m_warmstartingFactor;
solverInfo.m_maxGyroscopicForce = solverInfoData->m_solverInfo.m_maxGyroscopicForce;
solverInfo.m_singleAxisRollingFrictionThreshold = solverInfoData->m_solverInfo.m_singleAxisRollingFrictionThreshold;
solverInfo.m_numIterations = solverInfoData->m_solverInfo.m_numIterations;
solverInfo.m_solverMode = solverInfoData->m_solverInfo.m_solverMode;
solverInfo.m_restingContactRestitutionThreshold = solverInfoData->m_solverInfo.m_restingContactRestitutionThreshold;
solverInfo.m_minimumSolverBatchSize = solverInfoData->m_solverInfo.m_minimumSolverBatchSize;
solverInfo.m_splitImpulse = solverInfoData->m_solverInfo.m_splitImpulse;
setDynamicsWorldInfo(gravity,solverInfo);
}
}
for (i=0;i<bulletFile2->m_rigidBodies.size();i++)
@ -141,51 +216,14 @@ bool btBulletWorldImporter::convertAllObjects( bParse::btBulletFile* bulletFile
if (bulletFile2->getFlags() & bParse::FD_DOUBLE_PRECISION)
{
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 = m_shapeMap.find(colObjData->m_collisionObjectData.m_collisionShape);
if (shapePtr && *shapePtr)
{
btTransform startTransform;
colObjData->m_collisionObjectData.m_worldTransform.m_origin.m_floats[3] = 0.f;
startTransform.deSerializeDouble(colObjData->m_collisionObjectData.m_worldTransform);
// startTransform.setBasis(btMatrix3x3::getIdentity());
btCollisionShape* shape = (btCollisionShape*)*shapePtr;
if (shape->isNonMoving())
{
mass = 0.f;
}
if (mass)
{
shape->calculateLocalInertia(mass,localInertia);
}
bool isDynamic = mass!=0.f;
btRigidBody* body = createRigidBody(isDynamic,mass,startTransform,shape,colObjData->m_collisionObjectData.m_name);
#ifdef USE_INTERNAL_EDGE_UTILITY
if (shape->getShapeType() == TRIANGLE_MESH_SHAPE_PROXYTYPE)
{
btBvhTriangleMeshShape* trimesh = (btBvhTriangleMeshShape*)shape;
if (trimesh->getTriangleInfoMap())
{
body->setCollisionFlags(body->getCollisionFlags() | btCollisionObject::CF_CUSTOM_MATERIAL_CALLBACK);
}
}
#endif //USE_INTERNAL_EDGE_UTILITY
m_bodyMap.insert(colObjData,body);
} else
{
printf("error: no shape found\n");
}
convertRigidBodyDouble(colObjData);
} else
{
btRigidBodyFloatData* colObjData = (btRigidBodyFloatData*)bulletFile2->m_rigidBodies[i];
convertRigidBody(colObjData);
convertRigidBodyFloat(colObjData);
}
}
for (i=0;i<bulletFile2->m_collisionObjects.size();i++)

View File

@ -968,7 +968,15 @@ btCollisionObject* btWorldImporter::createCollisionObject(const btTransform& sta
return createRigidBody(false,0,startTransform,shape,bodyName);
}
void btWorldImporter::setDynamicsWorldInfo(const btVector3& gravity, const btContactSolverInfo& solverInfo)
{
if (m_dynamicsWorld)
{
m_dynamicsWorld->setGravity(gravity);
m_dynamicsWorld->getSolverInfo() = solverInfo;
}
}
btRigidBody* btWorldImporter::createRigidBody(bool isDynamic, btScalar mass, const btTransform& startTransform,btCollisionShape* shape,const char* bodyName)
{
@ -1310,7 +1318,8 @@ btTriangleInfoMap* btWorldImporter::getTriangleInfoMapByIndex(int index) const
return m_allocatedTriangleInfoMaps[index];
}
void btWorldImporter::convertRigidBody( btRigidBodyFloatData* colObjData)
void btWorldImporter::convertRigidBodyFloat( btRigidBodyFloatData* colObjData)
{
btScalar mass = btScalar(colObjData->m_inverseMass? 1.f/colObjData->m_inverseMass : 0.f);
btVector3 localInertia;
@ -1349,7 +1358,51 @@ void btWorldImporter::convertRigidBody( btRigidBodyFloatData* colObjData)
}
#endif //USE_INTERNAL_EDGE_UTILITY
m_bodyMap.insert(colObjData,body);
printf("colObjData = %lx\n", colObjData);
} else
{
printf("error: no shape found\n");
}
}
void btWorldImporter::convertRigidBodyDouble( btRigidBodyDoubleData* colObjData)
{
btScalar mass = btScalar(colObjData->m_inverseMass? 1.f/colObjData->m_inverseMass : 0.f);
btVector3 localInertia;
localInertia.setZero();
btCollisionShape** shapePtr = m_shapeMap.find(colObjData->m_collisionObjectData.m_collisionShape);
if (shapePtr && *shapePtr)
{
btTransform startTransform;
colObjData->m_collisionObjectData.m_worldTransform.m_origin.m_floats[3] = 0.f;
startTransform.deSerializeDouble(colObjData->m_collisionObjectData.m_worldTransform);
// startTransform.setBasis(btMatrix3x3::getIdentity());
btCollisionShape* shape = (btCollisionShape*)*shapePtr;
if (shape->isNonMoving())
{
mass = 0.f;
}
if (mass)
{
shape->calculateLocalInertia(mass,localInertia);
}
bool isDynamic = mass!=0.f;
btRigidBody* body = createRigidBody(isDynamic,mass,startTransform,shape,colObjData->m_collisionObjectData.m_name);
body->setFriction(colObjData->m_collisionObjectData.m_friction);
body->setRestitution(colObjData->m_collisionObjectData.m_restitution);
#ifdef USE_INTERNAL_EDGE_UTILITY
if (shape->getShapeType() == TRIANGLE_MESH_SHAPE_PROXYTYPE)
{
btBvhTriangleMeshShape* trimesh = (btBvhTriangleMeshShape*)shape;
if (trimesh->getTriangleInfoMap())
{
body->setCollisionFlags(body->getCollisionFlags() | btCollisionObject::CF_CUSTOM_MATERIAL_CALLBACK);
}
}
#endif //USE_INTERNAL_EDGE_UTILITY
m_bodyMap.insert(colObjData,body);
} else
{
printf("error: no shape found\n");

View File

@ -43,10 +43,19 @@ class btConeTwistConstraint;
class btGeneric6DofConstraint;
class btGeneric6DofSpringConstraint;
class btSliderConstraint;
struct btContactSolverInfo;
struct btTypedConstraintData;
class btTypedConstraintData;
struct btRigidBodyDoubleData;
struct btRigidBodyFloatData;
#ifdef BT_USE_DOUBLE_PRECISION
#define btRigidBodyData btRigidBodyDoubleData
#else
#define btRigidBodyData btRigidBodyFloatData
#endif//BT_USE_DOUBLE_PRECISION
class btWorldImporter
{
protected:
@ -92,7 +101,8 @@ protected:
btCollisionShape* convertCollisionShape( btCollisionShapeData* shapeData );
void convertConstraint(btTypedConstraintData* constraintData, btRigidBody* rbA, btRigidBody* rbB, bool isDoublePrecisionData, int fileVersion);
void convertRigidBody(btRigidBodyFloatData* colObjData);
void convertRigidBodyFloat(btRigidBodyFloatData* colObjData);
void convertRigidBodyDouble( btRigidBodyDoubleData* colObjData);
public:
@ -134,6 +144,8 @@ public:
///those virtuals are called by load and can be overridden by the user
virtual void setDynamicsWorldInfo(const btVector3& gravity, const btContactSolverInfo& solverInfo);
//bodies
virtual btRigidBody* createRigidBody(bool isDynamic, btScalar mass, const btTransform& startTransform, btCollisionShape* shape,const char* bodyName);
virtual btCollisionObject* createCollisionObject( const btTransform& startTransform, btCollisionShape* shape,const char* bodyName);

View File

@ -20,7 +20,8 @@ subject to the following restrictions:
btBulletXmlWorldImporter::btBulletXmlWorldImporter(btDynamicsWorld* world)
:btWorldImporter(world),
m_fileVersion(-1)
m_fileVersion(-1),
m_fileOk(false)
{
}
@ -337,9 +338,8 @@ void btBulletXmlWorldImporter::deSerializeGeneric6DofConstraintData(TiXmlNode* p
TiXmlNode* n = pParent->FirstChild("m_typeConstraintData");
if (n)
{
SET_POINTER_VALUE(n,dof6Data->m_typeConstraintData,m_rbA,btRigidBodyFloatData*);
SET_POINTER_VALUE(n,dof6Data->m_typeConstraintData,m_rbB,btRigidBodyFloatData*);
SET_POINTER_VALUE(n,dof6Data->m_typeConstraintData,m_rbA,btRigidBodyData*);
SET_POINTER_VALUE(n,dof6Data->m_typeConstraintData,m_rbB,btRigidBodyData*);
dof6Data->m_typeConstraintData.m_name = 0;//tbd
SET_INT_VALUE(n,&dof6Data->m_typeConstraintData,m_objectType);
SET_INT_VALUE(n,&dof6Data->m_typeConstraintData,m_userConstraintType);
@ -372,7 +372,7 @@ void btBulletXmlWorldImporter::deSerializeRigidBodyFloatData(TiXmlNode* pParent)
int ptr;
btAssert(get_int_attribute_by_name(pParent->ToElement(),"pointer",&ptr));
btRigidBodyFloatData* rbData = (btRigidBodyFloatData*)btAlignedAlloc(sizeof(btRigidBodyFloatData),16);
btRigidBodyData* rbData = (btRigidBodyData*)btAlignedAlloc(sizeof(btRigidBodyData),16);
TiXmlNode* n = pParent->FirstChild("m_collisionObjectData");
@ -485,13 +485,13 @@ void btBulletXmlWorldImporter::fixupConstraintData(btTypedConstraintData* tcd)
{
if (tcd->m_rbA)
{
btRigidBodyFloatData** ptrptr = (btRigidBodyFloatData**)m_pointerLookup.find((int)tcd->m_rbA);
btRigidBodyData** ptrptr = (btRigidBodyData**)m_pointerLookup.find((int)tcd->m_rbA);
btAssert(ptrptr);
tcd->m_rbA = ptrptr? *ptrptr : 0;
}
if (tcd->m_rbB)
{
btRigidBodyFloatData** ptrptr = (btRigidBodyFloatData**)m_pointerLookup.find((int)tcd->m_rbB);
btRigidBodyData** ptrptr = (btRigidBodyData**)m_pointerLookup.find((int)tcd->m_rbB);
btAssert(ptrptr);
tcd->m_rbB = ptrptr? *ptrptr : 0;
}
@ -636,7 +636,7 @@ void btBulletXmlWorldImporter::auto_serialize_root_level_children(TiXmlNode* pPa
///now fixup pointers
for (int i=0;i<m_rigidBodyData.size();i++)
{
btRigidBodyFloatData* rbData = m_rigidBodyData[i];
btRigidBodyData* rbData = m_rigidBodyData[i];
int hashKey = (int)rbData->m_collisionObjectData.m_collisionShape;
void** ptrptr = m_pointerLookup.find(hashKey);
btAssert(ptrptr);
@ -684,7 +684,11 @@ void btBulletXmlWorldImporter::auto_serialize_root_level_children(TiXmlNode* pPa
for (int i=0;i<m_rigidBodyData.size();i++)
{
convertRigidBody(m_rigidBodyData[i]);
#ifdef BT_USE_DOUBLE_PRECISION
convertRigidBodyDouble(m_rigidBodyData[i]);
#else
convertRigidBodyFloat(m_rigidBodyData[i]);
#endif
}
for (int i=0;i<m_constraintData.size();i++)
@ -745,18 +749,21 @@ bool btBulletXmlWorldImporter::loadFile(const char* fileName)
bool loadOkay = doc.LoadFile();
//dump_to_stdout(&doc,0);
int fileVersion=-1;
if (get_int_attribute_by_name(doc.FirstChildElement()->ToElement(),"version", &m_fileVersion))
if (loadOkay)
{
if (m_fileVersion==281)
if (get_int_attribute_by_name(doc.FirstChildElement()->ToElement(),"version", &m_fileVersion))
{
int itemcount;
assert(get_int_attribute_by_name(doc.FirstChildElement()->ToElement(),"itemcount", &itemcount));
auto_serialize(&doc);
if (m_fileVersion==281)
{
m_fileOk = true;
int itemcount;
assert(get_int_attribute_by_name(doc.FirstChildElement()->ToElement(),"itemcount", &itemcount));
auto_serialize(&doc);
return m_fileOk;
}
}
}
return false;

View File

@ -16,11 +16,19 @@ subject to the following restrictions:
#ifndef BT_BULLET_XML_WORLD_IMPORTER_H
#define BT_BULLET_XML_WORLD_IMPORTER_H
#include "LinearMath/btScalar.h"
class btDynamicsWorld;
class TiXmlNode;
struct btConvexInternalShapeData;
struct btCollisionShapeData;
#ifdef BT_USE_DOUBLE_PRECISION
struct btRigidBodyDoubleData;
#define btRigidBodyData btRigidBodyDoubleData
#else
struct btRigidBodyFloatData;
#define btRigidBodyData btRigidBodyFloatData
#endif//BT_USE_DOUBLE_PRECISION
struct btTypedConstraintData;
struct btCompoundShapeChildData;
@ -33,10 +41,11 @@ class btBulletXmlWorldImporter : public btWorldImporter
protected:
btAlignedObjectArray<btCollisionShapeData*> m_collisionShapeData;
btAlignedObjectArray<btCompoundShapeChildData*> m_compoundShapeChildData;
btAlignedObjectArray<btRigidBodyFloatData*> m_rigidBodyData;
btAlignedObjectArray<btRigidBodyData*> m_rigidBodyData;
btAlignedObjectArray<btTypedConstraintData*> m_constraintData;
btHashMap<btHashInt,void*> m_pointerLookup;
int m_fileVersion;
bool m_fileOk;
void auto_serialize_root_level_children(TiXmlNode* pParent);
void auto_serialize(TiXmlNode* pParent);

View File

@ -87,6 +87,7 @@ struct btContactSolverInfo : public btContactSolverInfoData
m_warmstartingFactor=btScalar(0.85);
//m_solverMode = SOLVER_USE_WARMSTARTING | SOLVER_SIMD | SOLVER_DISABLE_VELOCITY_DEPENDENT_FRICTION_DIRECTION|SOLVER_USE_2_FRICTION_DIRECTIONS|SOLVER_ENABLE_FRICTION_DIRECTION_CACHING;// | SOLVER_RANDMIZE_ORDER;
m_solverMode = SOLVER_USE_WARMSTARTING | SOLVER_SIMD;// | SOLVER_RANDMIZE_ORDER;
m_restingContactRestitutionThreshold = 2;//unused as of 2.81
m_minimumSolverBatchSize = 128; //try to combine islands until the amount of constraints reaches this limit
m_maxGyroscopicForce = 100.f; ///only used to clamp forces for bodies that have their BT_ENABLE_GYROPSCOPIC_FORCE flag set (using btRigidBody::setFlag)
m_singleAxisRollingFrictionThreshold = 1e30f;///if the velocity is above this threshold, it will use a single constraint row (axis), otherwise 3 rows.

View File

@ -1359,11 +1359,65 @@ void btDiscreteDynamicsWorld::serializeRigidBodies(btSerializer* serializer)
}
void btDiscreteDynamicsWorld::serializeDynamicsWorldInfo(btSerializer* serializer)
{
#ifdef BT_USE_DOUBLE_PRECISION
int len = sizeof(btDynamicsWorldDoubleData);
btChunk* chunk = serializer->allocate(len,1);
btDynamicsWorldDoubleData* worldInfo = (btDynamicsWorldDoubleData*)chunk->m_oldPtr;
#else//BT_USE_DOUBLE_PRECISION
int len = sizeof(btDynamicsWorldFloatData);
btChunk* chunk = serializer->allocate(len,1);
btDynamicsWorldFloatData* worldInfo = (btDynamicsWorldFloatData*)chunk->m_oldPtr;
#endif//BT_USE_DOUBLE_PRECISION
memset(worldInfo ,0x00,len);
m_gravity.serialize(worldInfo->m_gravity);
worldInfo->m_solverInfo.m_tau = getSolverInfo().m_tau;
worldInfo->m_solverInfo.m_damping = getSolverInfo().m_damping;
worldInfo->m_solverInfo.m_friction = getSolverInfo().m_friction;
worldInfo->m_solverInfo.m_timeStep = getSolverInfo().m_timeStep;
worldInfo->m_solverInfo.m_restitution = getSolverInfo().m_restitution;
worldInfo->m_solverInfo.m_maxErrorReduction = getSolverInfo().m_maxErrorReduction;
worldInfo->m_solverInfo.m_sor = getSolverInfo().m_sor;
worldInfo->m_solverInfo.m_erp = getSolverInfo().m_erp;
worldInfo->m_solverInfo.m_erp2 = getSolverInfo().m_erp2;
worldInfo->m_solverInfo.m_globalCfm = getSolverInfo().m_globalCfm;
worldInfo->m_solverInfo.m_splitImpulsePenetrationThreshold = getSolverInfo().m_splitImpulsePenetrationThreshold;
worldInfo->m_solverInfo.m_splitImpulseTurnErp = getSolverInfo().m_splitImpulseTurnErp;
worldInfo->m_solverInfo.m_linearSlop = getSolverInfo().m_linearSlop;
worldInfo->m_solverInfo.m_warmstartingFactor = getSolverInfo().m_warmstartingFactor;
worldInfo->m_solverInfo.m_maxGyroscopicForce = getSolverInfo().m_maxGyroscopicForce;
worldInfo->m_solverInfo.m_singleAxisRollingFrictionThreshold = getSolverInfo().m_singleAxisRollingFrictionThreshold;
worldInfo->m_solverInfo.m_numIterations = getSolverInfo().m_numIterations;
worldInfo->m_solverInfo.m_solverMode = getSolverInfo().m_solverMode;
worldInfo->m_solverInfo.m_restingContactRestitutionThreshold = getSolverInfo().m_restingContactRestitutionThreshold;
worldInfo->m_solverInfo.m_minimumSolverBatchSize = getSolverInfo().m_minimumSolverBatchSize;
worldInfo->m_solverInfo.m_splitImpulse = getSolverInfo().m_splitImpulse;
#ifdef BT_USE_DOUBLE_PRECISION
const char* structType = "btDynamicsWorldDoubleData";
#else//BT_USE_DOUBLE_PRECISION
const char* structType = "btDynamicsWorldFloatData";
#endif//BT_USE_DOUBLE_PRECISION
serializer->finalizeChunk(chunk,structType,BT_DYNAMICSWORLD_CODE,worldInfo);
}
void btDiscreteDynamicsWorld::serialize(btSerializer* serializer)
{
serializer->startSerialization();
serializeDynamicsWorldInfo(serializer);
serializeRigidBodies(serializer);
serializeCollisionObjects(serializer);

View File

@ -87,6 +87,8 @@ protected:
void serializeRigidBodies(btSerializer* serializer);
void serializeDynamicsWorldInfo(btSerializer* serializer);
public:

View File

@ -353,6 +353,8 @@ void btSoftRigidDynamicsWorld::serialize(btSerializer* serializer)
serializer->startSerialization();
serializeDynamicsWorldInfo( serializer);
serializeSoftBodies(serializer);
serializeRigidBodies(serializer);

View File

@ -122,6 +122,7 @@ public:
#define BT_ARRAY_CODE BT_MAKE_ID('A','R','A','Y')
#define BT_SBMATERIAL_CODE BT_MAKE_ID('S','B','M','T')
#define BT_SBNODE_CODE BT_MAKE_ID('S','B','N','D')
#define BT_DYNAMICSWORLD_CODE BT_MAKE_ID('D','W','L','D')
#define BT_DNA_CODE BT_MAKE_ID('D','N','A','1')