add starting point for btGeneric6DofSpring2ConstraintData import, not all parameters are deserialized though
restore activation state after picking add .bullet file import (only tested/available on Windows)
This commit is contained in:
@@ -953,6 +953,64 @@ void btWorldImporter::convertConstraintFloat(btTypedConstraintFloatData* constra
|
|||||||
constraint = gear;
|
constraint = gear;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case D6_SPRING_2_CONSTRAINT_TYPE:
|
||||||
|
{
|
||||||
|
|
||||||
|
btGeneric6DofSpring2ConstraintData* dofData = (btGeneric6DofSpring2ConstraintData*)constraintData;
|
||||||
|
|
||||||
|
btGeneric6DofSpring2Constraint* dof = 0;
|
||||||
|
|
||||||
|
if (rbA && rbB)
|
||||||
|
{
|
||||||
|
btTransform rbAFrame,rbBFrame;
|
||||||
|
rbAFrame.deSerializeFloat(dofData->m_rbAFrame);
|
||||||
|
rbBFrame.deSerializeFloat(dofData->m_rbBFrame);
|
||||||
|
dof = createGeneric6DofSpring2Constraint(*rbA,*rbB,rbAFrame,rbBFrame, dofData->m_rotateOrder);
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
printf("Error in btWorldImporter::createGeneric6DofSpring2Constraint: requires rbA && rbB\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dof)
|
||||||
|
{
|
||||||
|
btVector3 angLowerLimit,angUpperLimit, linLowerLimit,linUpperlimit;
|
||||||
|
angLowerLimit.deSerializeFloat(dofData->m_angularLowerLimit);
|
||||||
|
angUpperLimit.deSerializeFloat(dofData->m_angularUpperLimit);
|
||||||
|
linLowerLimit.deSerializeFloat(dofData->m_linearLowerLimit);
|
||||||
|
linUpperlimit.deSerializeFloat(dofData->m_linearUpperLimit);
|
||||||
|
|
||||||
|
angLowerLimit.setW(0.f);
|
||||||
|
dof->setAngularLowerLimit(angLowerLimit);
|
||||||
|
dof->setAngularUpperLimit(angUpperLimit);
|
||||||
|
dof->setLinearLowerLimit(linLowerLimit);
|
||||||
|
dof->setLinearUpperLimit(linUpperlimit);
|
||||||
|
|
||||||
|
int i;
|
||||||
|
if (fileVersion>280)
|
||||||
|
{
|
||||||
|
//6-dof: 3 linear followed by 3 angular
|
||||||
|
for (i=0;i<3;i++)
|
||||||
|
{
|
||||||
|
dof->setStiffness(i,dofData->m_linearSpringStiffness.m_floats[i]);
|
||||||
|
dof->setEquilibriumPoint(i,dofData->m_linearEquilibriumPoint.m_floats[i]);
|
||||||
|
dof->enableSpring(i,dofData->m_linearEnableSpring[i]!=0);
|
||||||
|
dof->setDamping(i,dofData->m_linearSpringDamping.m_floats[i]);
|
||||||
|
}
|
||||||
|
for (i=0;i<3;i++)
|
||||||
|
{
|
||||||
|
dof->setStiffness(i+3,dofData->m_angularSpringStiffness.m_floats[i]);
|
||||||
|
dof->setEquilibriumPoint(i+3,dofData->m_angularEquilibriumPoint.m_floats[i]);
|
||||||
|
dof->enableSpring(i+3,dofData->m_angularEnableSpring[i]!=0);
|
||||||
|
dof->setDamping(i+3,dofData->m_angularSpringDamping.m_floats[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
constraint = dof;
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
printf("unknown constraint type\n");
|
printf("unknown constraint type\n");
|
||||||
@@ -1193,6 +1251,65 @@ void btWorldImporter::convertConstraintDouble(btTypedConstraintDoubleData* const
|
|||||||
constraint = gear;
|
constraint = gear;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case D6_SPRING_2_CONSTRAINT_TYPE:
|
||||||
|
{
|
||||||
|
|
||||||
|
btGeneric6DofSpring2ConstraintDoubleData2* dofData = (btGeneric6DofSpring2ConstraintDoubleData2*)constraintData;
|
||||||
|
|
||||||
|
btGeneric6DofSpring2Constraint* dof = 0;
|
||||||
|
|
||||||
|
if (rbA && rbB)
|
||||||
|
{
|
||||||
|
btTransform rbAFrame,rbBFrame;
|
||||||
|
rbAFrame.deSerializeDouble(dofData->m_rbAFrame);
|
||||||
|
rbBFrame.deSerializeDouble(dofData->m_rbBFrame);
|
||||||
|
dof = createGeneric6DofSpring2Constraint(*rbA,*rbB,rbAFrame,rbBFrame, dofData->m_rotateOrder);
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
printf("Error in btWorldImporter::createGeneric6DofSpring2Constraint: requires rbA && rbB\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dof)
|
||||||
|
{
|
||||||
|
btVector3 angLowerLimit,angUpperLimit, linLowerLimit,linUpperlimit;
|
||||||
|
angLowerLimit.deSerializeDouble(dofData->m_angularLowerLimit);
|
||||||
|
angUpperLimit.deSerializeDouble(dofData->m_angularUpperLimit);
|
||||||
|
linLowerLimit.deSerializeDouble(dofData->m_linearLowerLimit);
|
||||||
|
linUpperlimit.deSerializeDouble(dofData->m_linearUpperLimit);
|
||||||
|
|
||||||
|
angLowerLimit.setW(0.f);
|
||||||
|
dof->setAngularLowerLimit(angLowerLimit);
|
||||||
|
dof->setAngularUpperLimit(angUpperLimit);
|
||||||
|
dof->setLinearLowerLimit(linLowerLimit);
|
||||||
|
dof->setLinearUpperLimit(linUpperlimit);
|
||||||
|
|
||||||
|
int i;
|
||||||
|
if (fileVersion>280)
|
||||||
|
{
|
||||||
|
//6-dof: 3 linear followed by 3 angular
|
||||||
|
for (i=0;i<3;i++)
|
||||||
|
{
|
||||||
|
dof->setStiffness(i,dofData->m_linearSpringStiffness.m_floats[i]);
|
||||||
|
dof->setEquilibriumPoint(i,dofData->m_linearEquilibriumPoint.m_floats[i]);
|
||||||
|
dof->enableSpring(i,dofData->m_linearEnableSpring[i]!=0);
|
||||||
|
dof->setDamping(i,dofData->m_linearSpringDamping.m_floats[i]);
|
||||||
|
}
|
||||||
|
for (i=0;i<3;i++)
|
||||||
|
{
|
||||||
|
dof->setStiffness(i+3,dofData->m_angularSpringStiffness.m_floats[i]);
|
||||||
|
dof->setEquilibriumPoint(i+3,dofData->m_angularEquilibriumPoint.m_floats[i]);
|
||||||
|
dof->enableSpring(i+3,dofData->m_angularEnableSpring[i]!=0);
|
||||||
|
dof->setDamping(i+3,dofData->m_angularSpringDamping.m_floats[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
constraint = dof;
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
printf("unknown constraint type\n");
|
printf("unknown constraint type\n");
|
||||||
@@ -1711,6 +1828,15 @@ btGeneric6DofConstraint* btWorldImporter::createGeneric6DofConstraint(btRigidBod
|
|||||||
return dof;
|
return dof;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
btGeneric6DofSpring2Constraint* btWorldImporter::createGeneric6DofSpring2Constraint(btRigidBody& rbA, btRigidBody& rbB, const btTransform& frameInA, const btTransform& frameInB, int rotateOrder)
|
||||||
|
{
|
||||||
|
btGeneric6DofSpring2Constraint* dof = new btGeneric6DofSpring2Constraint(rbA,rbB,frameInA,frameInB, (RotateOrder)rotateOrder);
|
||||||
|
m_allocatedConstraints.push_back(dof);
|
||||||
|
return dof;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
btGeneric6DofSpringConstraint* btWorldImporter::createGeneric6DofSpringConstraint(btRigidBody& rbA, btRigidBody& rbB, const btTransform& frameInA, const btTransform& frameInB ,bool useLinearReferenceFrameA)
|
btGeneric6DofSpringConstraint* btWorldImporter::createGeneric6DofSpringConstraint(btRigidBody& rbA, btRigidBody& rbB, const btTransform& frameInA, const btTransform& frameInB ,bool useLinearReferenceFrameA)
|
||||||
{
|
{
|
||||||
btGeneric6DofSpringConstraint* dof = new btGeneric6DofSpringConstraint(rbA,rbB,frameInA,frameInB,useLinearReferenceFrameA);
|
btGeneric6DofSpringConstraint* dof = new btGeneric6DofSpringConstraint(rbA,rbB,frameInA,frameInB,useLinearReferenceFrameA);
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ class btHingeConstraint;
|
|||||||
class btConeTwistConstraint;
|
class btConeTwistConstraint;
|
||||||
class btGeneric6DofConstraint;
|
class btGeneric6DofConstraint;
|
||||||
class btGeneric6DofSpringConstraint;
|
class btGeneric6DofSpringConstraint;
|
||||||
|
class btGeneric6DofSpring2Constraint;
|
||||||
class btSliderConstraint;
|
class btSliderConstraint;
|
||||||
class btGearConstraint;
|
class btGearConstraint;
|
||||||
struct btContactSolverInfo;
|
struct btContactSolverInfo;
|
||||||
@@ -199,6 +200,8 @@ public:
|
|||||||
virtual btGeneric6DofConstraint* createGeneric6DofConstraint(btRigidBody& rbA, btRigidBody& rbB, const btTransform& frameInA, const btTransform& frameInB ,bool useLinearReferenceFrameA);
|
virtual btGeneric6DofConstraint* createGeneric6DofConstraint(btRigidBody& rbA, btRigidBody& rbB, const btTransform& frameInA, const btTransform& frameInB ,bool useLinearReferenceFrameA);
|
||||||
virtual btGeneric6DofConstraint* createGeneric6DofConstraint(btRigidBody& rbB, const btTransform& frameInB, bool useLinearReferenceFrameB);
|
virtual btGeneric6DofConstraint* createGeneric6DofConstraint(btRigidBody& rbB, const btTransform& frameInB, bool useLinearReferenceFrameB);
|
||||||
virtual btGeneric6DofSpringConstraint* createGeneric6DofSpringConstraint(btRigidBody& rbA, btRigidBody& rbB, const btTransform& frameInA, const btTransform& frameInB ,bool useLinearReferenceFrameA);
|
virtual btGeneric6DofSpringConstraint* createGeneric6DofSpringConstraint(btRigidBody& rbA, btRigidBody& rbB, const btTransform& frameInA, const btTransform& frameInB ,bool useLinearReferenceFrameA);
|
||||||
|
virtual btGeneric6DofSpring2Constraint* createGeneric6DofSpring2Constraint(btRigidBody& rbA, btRigidBody& rbB, const btTransform& frameInA, const btTransform& frameInB, int rotateOrder );
|
||||||
|
|
||||||
virtual btSliderConstraint* createSliderConstraint(btRigidBody& rbA, btRigidBody& rbB, const btTransform& frameInA, const btTransform& frameInB ,bool useLinearReferenceFrameA);
|
virtual btSliderConstraint* createSliderConstraint(btRigidBody& rbA, btRigidBody& rbB, const btTransform& frameInA, const btTransform& frameInB ,bool useLinearReferenceFrameA);
|
||||||
virtual btSliderConstraint* createSliderConstraint(btRigidBody& rbB, const btTransform& frameInB, bool useLinearReferenceFrameA);
|
virtual btSliderConstraint* createSliderConstraint(btRigidBody& rbB, const btTransform& frameInB, bool useLinearReferenceFrameA);
|
||||||
virtual btGearConstraint* createGearConstraint(btRigidBody& rbA, btRigidBody& rbB, const btVector3& axisInA,const btVector3& axisInB, btScalar ratio);
|
virtual btGearConstraint* createGearConstraint(btRigidBody& rbA, btRigidBody& rbB, const btVector3& axisInA,const btVector3& axisInB, btScalar ratio);
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ struct CommonRigidBodyBase : public CommonExampleInterface
|
|||||||
//data for picking objects
|
//data for picking objects
|
||||||
class btRigidBody* m_pickedBody;
|
class btRigidBody* m_pickedBody;
|
||||||
class btTypedConstraint* m_pickedConstraint;
|
class btTypedConstraint* m_pickedConstraint;
|
||||||
|
int m_savedState;
|
||||||
btVector3 m_oldPickingPos;
|
btVector3 m_oldPickingPos;
|
||||||
btVector3 m_hitPos;
|
btVector3 m_hitPos;
|
||||||
btScalar m_oldPickingDist;
|
btScalar m_oldPickingDist;
|
||||||
@@ -156,6 +157,19 @@ struct CommonRigidBodyBase : public CommonExampleInterface
|
|||||||
|
|
||||||
virtual bool keyboardCallback(int key, int state)
|
virtual bool keyboardCallback(int key, int state)
|
||||||
{
|
{
|
||||||
|
if ((key==B3G_F3) && state && m_dynamicsWorld)
|
||||||
|
{
|
||||||
|
btDefaultSerializer* serializer = new btDefaultSerializer();
|
||||||
|
m_dynamicsWorld->serialize(serializer);
|
||||||
|
|
||||||
|
FILE* file = fopen("testFile.bullet","wb");
|
||||||
|
fwrite(serializer->getBufferPointer(),serializer->getCurrentBufferSize(),1, file);
|
||||||
|
fclose(file);
|
||||||
|
//b3Printf("btDefaultSerializer wrote testFile.bullet");
|
||||||
|
delete serializer;
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
return false;//don't handle this key
|
return false;//don't handle this key
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -329,6 +343,7 @@ struct CommonRigidBodyBase : public CommonExampleInterface
|
|||||||
if (!(body->isStaticObject() || body->isKinematicObject()))
|
if (!(body->isStaticObject() || body->isKinematicObject()))
|
||||||
{
|
{
|
||||||
m_pickedBody = body;
|
m_pickedBody = body;
|
||||||
|
m_savedState = m_pickedBody->getActivationState();
|
||||||
m_pickedBody->setActivationState(DISABLE_DEACTIVATION);
|
m_pickedBody->setActivationState(DISABLE_DEACTIVATION);
|
||||||
//printf("pickPos=%f,%f,%f\n",pickPos.getX(),pickPos.getY(),pickPos.getZ());
|
//printf("pickPos=%f,%f,%f\n",pickPos.getX(),pickPos.getY(),pickPos.getZ());
|
||||||
btVector3 localPivot = body->getCenterOfMassTransform().inverse() * pickPos;
|
btVector3 localPivot = body->getCenterOfMassTransform().inverse() * pickPos;
|
||||||
@@ -378,6 +393,8 @@ struct CommonRigidBodyBase : public CommonExampleInterface
|
|||||||
{
|
{
|
||||||
if (m_pickedConstraint)
|
if (m_pickedConstraint)
|
||||||
{
|
{
|
||||||
|
m_pickedBody->forceActivationState(m_savedState);
|
||||||
|
m_pickedBody->activate();
|
||||||
m_dynamicsWorld->removeConstraint(m_pickedConstraint);
|
m_dynamicsWorld->removeConstraint(m_pickedConstraint);
|
||||||
delete m_pickedConstraint;
|
delete m_pickedConstraint;
|
||||||
m_pickedConstraint = 0;
|
m_pickedConstraint = 0;
|
||||||
|
|||||||
@@ -33,9 +33,12 @@
|
|||||||
#include "../OpenGLWindow/SimpleOpenGL2Renderer.h"
|
#include "../OpenGLWindow/SimpleOpenGL2Renderer.h"
|
||||||
#include "ExampleEntries.h"
|
#include "ExampleEntries.h"
|
||||||
#include "OpenGLGuiHelper.h"
|
#include "OpenGLGuiHelper.h"
|
||||||
|
#include "Bullet3Common/b3FileUtils.h"
|
||||||
|
|
||||||
#include "LinearMath/btIDebugDraw.h"
|
#include "LinearMath/btIDebugDraw.h"
|
||||||
//quick test for file import, @todo(erwincoumans) make it more general and add other file formats
|
//quick test for file import, @todo(erwincoumans) make it more general and add other file formats
|
||||||
#include "../Importers/ImportURDFDemo/ImportURDFSetup.h"
|
#include "../Importers/ImportURDFDemo/ImportURDFSetup.h"
|
||||||
|
#include "../Importers/ImportBullet/SerializeSetup.h"
|
||||||
|
|
||||||
static CommonGraphicsApp* s_app=0;
|
static CommonGraphicsApp* s_app=0;
|
||||||
|
|
||||||
@@ -191,7 +194,7 @@ static void MyMouseButtonCallback(int button, int state, float x, float y)
|
|||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
void openURDFDemo(const char* filename)
|
void openFileDemo(const char* filename)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (sCurrentDemo)
|
if (sCurrentDemo)
|
||||||
@@ -211,7 +214,21 @@ void openURDFDemo(const char* filename)
|
|||||||
CommonExampleOptions options(s_guiHelper,0);
|
CommonExampleOptions options(s_guiHelper,0);
|
||||||
options.m_fileName = filename;
|
options.m_fileName = filename;
|
||||||
|
|
||||||
sCurrentDemo = ImportURDFCreateFunc(options);
|
char fullPath[1024];
|
||||||
|
int fileType = 0;
|
||||||
|
sprintf(fullPath, "%s", filename);
|
||||||
|
b3FileUtils::toLower(fullPath);
|
||||||
|
if (strstr(fullPath, ".urdf"))
|
||||||
|
{
|
||||||
|
sCurrentDemo = ImportURDFCreateFunc(options);
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
if (strstr(fullPath, ".bullet"))
|
||||||
|
{
|
||||||
|
sCurrentDemo = SerializeBulletCreateFunc(options);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//physicsSetup->setFileName(filename);
|
//physicsSetup->setFileName(filename);
|
||||||
|
|
||||||
@@ -471,7 +488,7 @@ void fileOpenCallback()
|
|||||||
{
|
{
|
||||||
//todo(erwincoumans) check if it is actually URDF
|
//todo(erwincoumans) check if it is actually URDF
|
||||||
//printf("file open:%s\n", filename);
|
//printf("file open:%s\n", filename);
|
||||||
openURDFDemo(filename);
|
openFileDemo(filename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,13 +6,19 @@
|
|||||||
|
|
||||||
class SerializeSetup : public CommonRigidBodyBase
|
class SerializeSetup : public CommonRigidBodyBase
|
||||||
{
|
{
|
||||||
|
|
||||||
|
char m_fileName[1024];
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SerializeSetup(struct GUIHelperInterface* helper);
|
SerializeSetup(struct GUIHelperInterface* helper, const char* fileName);
|
||||||
virtual ~SerializeSetup();
|
virtual ~SerializeSetup();
|
||||||
|
|
||||||
virtual void initPhysics();
|
virtual void initPhysics();
|
||||||
virtual void stepSimulation(float deltaTime);
|
virtual void stepSimulation(float deltaTime);
|
||||||
|
virtual void setFileName(const char* fileName)
|
||||||
|
{
|
||||||
|
memcpy(m_fileName,fileName,strlen(fileName)+1);
|
||||||
|
}
|
||||||
virtual void resetCamera()
|
virtual void resetCamera()
|
||||||
{
|
{
|
||||||
float dist = 9.5;
|
float dist = 9.5;
|
||||||
@@ -25,10 +31,16 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
SerializeSetup::SerializeSetup(struct GUIHelperInterface* helper)
|
SerializeSetup::SerializeSetup(struct GUIHelperInterface* helper, const char* fileName)
|
||||||
:CommonRigidBodyBase(helper)
|
:CommonRigidBodyBase(helper)
|
||||||
{
|
{
|
||||||
|
if (fileName)
|
||||||
|
{
|
||||||
|
setFileName(fileName);
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
setFileName("spider.bullet");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
SerializeSetup::~SerializeSetup()
|
SerializeSetup::~SerializeSetup()
|
||||||
{
|
{
|
||||||
@@ -41,9 +53,9 @@ void SerializeSetup::initPhysics()
|
|||||||
m_guiHelper->createPhysicsDebugDrawer(m_dynamicsWorld);
|
m_guiHelper->createPhysicsDebugDrawer(m_dynamicsWorld);
|
||||||
m_dynamicsWorld->getDebugDrawer()->setDebugMode(btIDebugDraw::DBG_DrawWireframe+btIDebugDraw::DBG_DrawContactPoints);
|
m_dynamicsWorld->getDebugDrawer()->setDebugMode(btIDebugDraw::DBG_DrawWireframe+btIDebugDraw::DBG_DrawContactPoints);
|
||||||
btBulletWorldImporter* importer = new btBulletWorldImporter(m_dynamicsWorld);
|
btBulletWorldImporter* importer = new btBulletWorldImporter(m_dynamicsWorld);
|
||||||
const char* someFileName="spider.bullet";
|
|
||||||
|
|
||||||
const char* prefix[]={"./","./data/","../data/","../../data/","../../../data/","../../../../data/"};
|
|
||||||
|
const char* prefix[]={"","./","./data/","../data/","../../data/","../../../data/","../../../../data/"};
|
||||||
int numPrefixes = sizeof(prefix)/sizeof(const char*);
|
int numPrefixes = sizeof(prefix)/sizeof(const char*);
|
||||||
char relativeFileName[1024];
|
char relativeFileName[1024];
|
||||||
FILE* f=0;
|
FILE* f=0;
|
||||||
@@ -52,7 +64,7 @@ void SerializeSetup::initPhysics()
|
|||||||
|
|
||||||
for (int i=0;!f && i<numPrefixes;i++)
|
for (int i=0;!f && i<numPrefixes;i++)
|
||||||
{
|
{
|
||||||
sprintf(relativeFileName,"%s%s",prefix[i],someFileName);
|
sprintf(relativeFileName,"%s%s",prefix[i],m_fileName);
|
||||||
f = fopen(relativeFileName,"rb");
|
f = fopen(relativeFileName,"rb");
|
||||||
if (f)
|
if (f)
|
||||||
{
|
{
|
||||||
@@ -84,7 +96,7 @@ void SerializeSetup::initPhysics()
|
|||||||
btDefaultSerializer* serializer = new btDefaultSerializer();
|
btDefaultSerializer* serializer = new btDefaultSerializer();
|
||||||
m_dynamicsWorld->serialize(serializer);
|
m_dynamicsWorld->serialize(serializer);
|
||||||
|
|
||||||
FILE* file = fopen("testFile.bullet","wb");
|
FILE* file = fopen("SerializeSetupTestFile.bullet","wb");
|
||||||
fwrite(serializer->getBufferPointer(),serializer->getCurrentBufferSize(),1, file);
|
fwrite(serializer->getBufferPointer(),serializer->getCurrentBufferSize(),1, file);
|
||||||
fclose(file);
|
fclose(file);
|
||||||
|
|
||||||
@@ -101,5 +113,5 @@ void SerializeSetup::stepSimulation(float deltaTime)
|
|||||||
|
|
||||||
class CommonExampleInterface* SerializeBulletCreateFunc(struct CommonExampleOptions& options)
|
class CommonExampleInterface* SerializeBulletCreateFunc(struct CommonExampleOptions& options)
|
||||||
{
|
{
|
||||||
return new SerializeSetup(options.m_guiHelper);
|
return new SerializeSetup(options.m_guiHelper, options.m_fileName);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -157,13 +157,13 @@ int Win32OpenGLWindow::fileOpenDialog(char* fileName, int maxFileNameLength)
|
|||||||
ofn.lpstrFile = bla;
|
ofn.lpstrFile = bla;
|
||||||
ofn.lpstrFile[0] = '\0';
|
ofn.lpstrFile[0] = '\0';
|
||||||
ofn.nMaxFile = 1023;
|
ofn.nMaxFile = 1023;
|
||||||
ofn.lpstrFilter = L"URDF\0*.urdf\0";
|
ofn.lpstrFilter = L"All Files\0*.*\0URDF\0*.urdf\0.bullet\0*.bullet\0";
|
||||||
#else
|
#else
|
||||||
ofn.lpstrFile = fileName;
|
ofn.lpstrFile = fileName;
|
||||||
ofn.lpstrFile[0] = '\0';
|
ofn.lpstrFile[0] = '\0';
|
||||||
ofn.nMaxFile = 1023;
|
ofn.nMaxFile = 1023;
|
||||||
//ofn.lpstrFilter = "All\0*.*\0Text\0*.TXT\0";
|
//ofn.lpstrFilter = "All\0*.*\0Text\0*.TXT\0";
|
||||||
ofn.lpstrFilter = "URDF\0*.urdf\0";
|
ofn.lpstrFilter = "All Files\0*.*\0URDF\0*.urdf\0.bullet\0*.bullet\0";
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -64,10 +64,7 @@ int getAsciiCodeFromVirtualKeycode(int virtualKeyCode)
|
|||||||
{
|
{
|
||||||
return virtualKeyCode;
|
return virtualKeyCode;
|
||||||
}
|
}
|
||||||
if (virtualKeyCode >= 'a' && virtualKeyCode <= 'z')
|
|
||||||
{
|
|
||||||
return virtualKeyCode;
|
|
||||||
}
|
|
||||||
if (virtualKeyCode >= 'A' && virtualKeyCode <= 'Z')
|
if (virtualKeyCode >= 'A' && virtualKeyCode <= 'Z')
|
||||||
{
|
{
|
||||||
return virtualKeyCode+32;//todo: fix the ascii A vs a input
|
return virtualKeyCode+32;//todo: fix the ascii A vs a input
|
||||||
|
|||||||
Reference in New Issue
Block a user