fix shadowmap crash on some Intel GPUs, see https://github.com/bulletphysics/bullet3/issues/4
remove targetdir from all libraries in premake, so it is much easier to create a separate folder for all binary+lib transmit the serialized btMultiBody data back from server to client, after the server loads a URDF file. This includes base+link+joint names tweak the serialization routines, so it is easier to skip pointers and to serialize directly to a shared memory buffer also tweak the serialization code to allow to process data without 'DNA' schema data (assuming file-DNA = memory DNA)
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
project "ConvexDecomposition"
|
||||
|
||||
kind "StaticLib"
|
||||
targetdir "../../lib"
|
||||
|
||||
includedirs {".","../../src"}
|
||||
files {
|
||||
"**.cpp",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
project "HACD"
|
||||
|
||||
kind "StaticLib"
|
||||
targetdir "../../lib"
|
||||
|
||||
includedirs {"."}
|
||||
files {
|
||||
"**.cpp",
|
||||
|
||||
@@ -600,23 +600,6 @@ typedef struct bInvalidHandle {
|
||||
};
|
||||
|
||||
|
||||
// -------------------------------------------------- //
|
||||
class btDynamicsWorldDoubleData
|
||||
{
|
||||
public:
|
||||
btContactSolverInfoDoubleData m_solverInfo;
|
||||
btVector3DoubleData m_gravity;
|
||||
};
|
||||
|
||||
|
||||
// -------------------------------------------------- //
|
||||
class btDynamicsWorldFloatData
|
||||
{
|
||||
public:
|
||||
btContactSolverInfoFloatData m_solverInfo;
|
||||
btVector3FloatData m_gravity;
|
||||
};
|
||||
|
||||
|
||||
// -------------------------------------------------- //
|
||||
class btRigidBodyFloatData
|
||||
@@ -1135,6 +1118,24 @@ typedef struct bInvalidHandle {
|
||||
char m_padding[4];
|
||||
};
|
||||
|
||||
// -------------------------------------------------- //
|
||||
class btDynamicsWorldDoubleData
|
||||
{
|
||||
public:
|
||||
btContactSolverInfoDoubleData m_solverInfo;
|
||||
btVector3DoubleData m_gravity;
|
||||
};
|
||||
|
||||
|
||||
// -------------------------------------------------- //
|
||||
class btDynamicsWorldFloatData
|
||||
{
|
||||
public:
|
||||
btContactSolverInfoFloatData m_solverInfo;
|
||||
btVector3FloatData m_gravity;
|
||||
};
|
||||
|
||||
|
||||
|
||||
// -------------------------------------------------- //
|
||||
class SoftBodyMaterialData
|
||||
|
||||
@@ -187,87 +187,105 @@ bool bFile::ok()
|
||||
return (mFlags &FD_OK)!=0;
|
||||
}
|
||||
|
||||
void bFile::setFileDNA(int verboseMode, char* dnaBuffer, int dnaLen)
|
||||
{
|
||||
mFileDNA = new bDNA();
|
||||
|
||||
///mFileDNA->init will convert part of DNA file endianness to current CPU endianness if necessary
|
||||
mFileDNA->init((char*)dnaBuffer, dnaLen, (mFlags & FD_ENDIAN_SWAP)!=0);
|
||||
|
||||
if (verboseMode & FD_VERBOSE_DUMP_DNA_TYPE_DEFINITIONS)
|
||||
mFileDNA->dumpTypeDefinitions();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------- //
|
||||
void bFile::parseInternal(int verboseMode, char* memDna,int memDnaLength)
|
||||
{
|
||||
if ( (mFlags &FD_OK) ==0)
|
||||
return;
|
||||
|
||||
char *blenderData = mFileBuffer;
|
||||
bChunkInd dna;
|
||||
dna.oldPtr = 0;
|
||||
|
||||
char *tempBuffer = blenderData;
|
||||
for (int i=0; i<mFileLen; i++)
|
||||
if (mFlags & FD_FILEDNA_IS_MEMDNA)
|
||||
{
|
||||
// looking for the data's starting position
|
||||
// and the start of SDNA decls
|
||||
setFileDNA(verboseMode,memDna,memDnaLength);
|
||||
}
|
||||
|
||||
if (!mDataStart && strncmp(tempBuffer, "REND", 4)==0)
|
||||
mDataStart = i;
|
||||
if (mFileDNA==0)
|
||||
{
|
||||
char *blenderData = mFileBuffer;
|
||||
bChunkInd dna;
|
||||
dna.oldPtr = 0;
|
||||
|
||||
if (strncmp(tempBuffer, "DNA1", 4)==0)
|
||||
char *tempBuffer = blenderData;
|
||||
for (int i=0; i<mFileLen; i++)
|
||||
{
|
||||
// read the DNA1 block and extract SDNA
|
||||
if (getNextBlock(&dna, tempBuffer, mFlags) > 0)
|
||||
// looking for the data's starting position
|
||||
// and the start of SDNA decls
|
||||
|
||||
if (!mDataStart && strncmp(tempBuffer, "REND", 4)==0)
|
||||
mDataStart = i;
|
||||
|
||||
if (strncmp(tempBuffer, "DNA1", 4)==0)
|
||||
{
|
||||
if (strncmp((tempBuffer + ChunkUtils::getOffset(mFlags)), "SDNANAME", 8) ==0)
|
||||
dna.oldPtr = (tempBuffer + ChunkUtils::getOffset(mFlags));
|
||||
// read the DNA1 block and extract SDNA
|
||||
if (getNextBlock(&dna, tempBuffer, mFlags) > 0)
|
||||
{
|
||||
if (strncmp((tempBuffer + ChunkUtils::getOffset(mFlags)), "SDNANAME", 8) ==0)
|
||||
dna.oldPtr = (tempBuffer + ChunkUtils::getOffset(mFlags));
|
||||
else dna.oldPtr = 0;
|
||||
}
|
||||
else dna.oldPtr = 0;
|
||||
}
|
||||
else dna.oldPtr = 0;
|
||||
}
|
||||
// Some Bullet files are missing the DNA1 block
|
||||
// In Blender it's DNA1 + ChunkUtils::getOffset() + SDNA + NAME
|
||||
// In Bullet tests its SDNA + NAME
|
||||
else if (strncmp(tempBuffer, "SDNANAME", 8) ==0)
|
||||
{
|
||||
dna.oldPtr = blenderData + i;
|
||||
dna.len = mFileLen-i;
|
||||
|
||||
// Also no REND block, so exit now.
|
||||
if (mVersion==276) break;
|
||||
}
|
||||
|
||||
if (mDataStart && dna.oldPtr) break;
|
||||
tempBuffer++;
|
||||
}
|
||||
if (!dna.oldPtr || !dna.len)
|
||||
{
|
||||
//printf("Failed to find DNA1+SDNA pair\n");
|
||||
mFlags &= ~FD_OK;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
mFileDNA = new bDNA();
|
||||
|
||||
|
||||
///mFileDNA->init will convert part of DNA file endianness to current CPU endianness if necessary
|
||||
mFileDNA->init((char*)dna.oldPtr, dna.len, (mFlags & FD_ENDIAN_SWAP)!=0);
|
||||
|
||||
|
||||
if (mVersion==276)
|
||||
{
|
||||
int i;
|
||||
for (i=0;i<mFileDNA->getNumNames();i++)
|
||||
{
|
||||
if (strcmp(mFileDNA->getName(i),"int")==0)
|
||||
}
|
||||
// Some Bullet files are missing the DNA1 block
|
||||
// In Blender it's DNA1 + ChunkUtils::getOffset() + SDNA + NAME
|
||||
// In Bullet tests its SDNA + NAME
|
||||
else if (strncmp(tempBuffer, "SDNANAME", 8) ==0)
|
||||
{
|
||||
mFlags |= FD_BROKEN_DNA;
|
||||
dna.oldPtr = blenderData + i;
|
||||
dna.len = mFileLen-i;
|
||||
|
||||
// Also no REND block, so exit now.
|
||||
if (mVersion==276) break;
|
||||
}
|
||||
|
||||
if (mDataStart && dna.oldPtr) break;
|
||||
tempBuffer++;
|
||||
}
|
||||
if (!dna.oldPtr || !dna.len)
|
||||
{
|
||||
//printf("Failed to find DNA1+SDNA pair\n");
|
||||
mFlags &= ~FD_OK;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
mFileDNA = new bDNA();
|
||||
|
||||
|
||||
///mFileDNA->init will convert part of DNA file endianness to current CPU endianness if necessary
|
||||
mFileDNA->init((char*)dna.oldPtr, dna.len, (mFlags & FD_ENDIAN_SWAP)!=0);
|
||||
|
||||
|
||||
if (mVersion==276)
|
||||
{
|
||||
int i;
|
||||
for (i=0;i<mFileDNA->getNumNames();i++)
|
||||
{
|
||||
if (strcmp(mFileDNA->getName(i),"int")==0)
|
||||
{
|
||||
mFlags |= FD_BROKEN_DNA;
|
||||
}
|
||||
}
|
||||
if ((mFlags&FD_BROKEN_DNA)!=0)
|
||||
{
|
||||
//printf("warning: fixing some broken DNA version\n");
|
||||
}
|
||||
}
|
||||
if ((mFlags&FD_BROKEN_DNA)!=0)
|
||||
{
|
||||
//printf("warning: fixing some broken DNA version\n");
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (verboseMode & FD_VERBOSE_DUMP_DNA_TYPE_DEFINITIONS)
|
||||
mFileDNA->dumpTypeDefinitions();
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (verboseMode & FD_VERBOSE_DUMP_DNA_TYPE_DEFINITIONS)
|
||||
mFileDNA->dumpTypeDefinitions();
|
||||
|
||||
mMemoryDNA = new bDNA();
|
||||
int littleEndian= 1;
|
||||
littleEndian= ((char*)&littleEndian)[0];
|
||||
|
||||
@@ -33,7 +33,8 @@ namespace bParse {
|
||||
FD_BITS_VARIES =16,
|
||||
FD_VERSION_VARIES = 32,
|
||||
FD_DOUBLE_PRECISION =64,
|
||||
FD_BROKEN_DNA = 128
|
||||
FD_BROKEN_DNA = 128,
|
||||
FD_FILEDNA_IS_MEMDNA = 256
|
||||
};
|
||||
|
||||
enum bFileVerboseMode
|
||||
@@ -106,7 +107,7 @@ namespace bParse {
|
||||
char* readStruct(char *head, class bChunkInd& chunk);
|
||||
char *getAsString(int code);
|
||||
|
||||
void parseInternal(int verboseMode, char* memDna,int memDnaLength);
|
||||
virtual void parseInternal(int verboseMode, char* memDna,int memDnaLength);
|
||||
|
||||
public:
|
||||
bFile(const char *filename, const char headerString[7]);
|
||||
@@ -128,6 +129,11 @@ namespace bParse {
|
||||
return mFlags;
|
||||
}
|
||||
|
||||
void setFileDNAisMemoryDNA()
|
||||
{
|
||||
mFlags |= FD_FILEDNA_IS_MEMDNA;
|
||||
}
|
||||
|
||||
bPtrMap& getLibPointers()
|
||||
{
|
||||
return mLibPointers;
|
||||
@@ -150,6 +156,8 @@ namespace bParse {
|
||||
|
||||
void dumpChunks(bDNA* dna);
|
||||
|
||||
virtual void setFileDNA(int verboseMode, char* buffer, int len);
|
||||
|
||||
int getVersion() const
|
||||
{
|
||||
return mVersion;
|
||||
@@ -158,6 +166,8 @@ namespace bParse {
|
||||
void preSwap();
|
||||
void writeFile(const char* fileName);
|
||||
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -123,7 +123,11 @@ void btBulletFile::parseData()
|
||||
//const bool swap = (mFlags&FD_ENDIAN_SWAP)!=0;
|
||||
|
||||
|
||||
int remain = mFileLen;
|
||||
|
||||
mDataStart = 12;
|
||||
remain-=12;
|
||||
|
||||
|
||||
char *dataPtr = mFileBuffer+mDataStart;
|
||||
|
||||
@@ -169,6 +173,11 @@ void btBulletFile::parseData()
|
||||
// listID->push_back((bStructHandle*)id);
|
||||
}
|
||||
|
||||
if (dataChunk.code == BT_MULTIBODY_CODE)
|
||||
{
|
||||
m_multiBodies.push_back((bStructHandle*)id);
|
||||
}
|
||||
|
||||
if (dataChunk.code == BT_SOFTBODY_CODE)
|
||||
{
|
||||
m_softBodies.push_back((bStructHandle*) id);
|
||||
@@ -226,6 +235,9 @@ void btBulletFile::parseData()
|
||||
|
||||
|
||||
dataPtr += seek;
|
||||
remain-=seek;
|
||||
if (remain<=0)
|
||||
break;
|
||||
|
||||
seek = getNextBlock(&dataChunk, dataPtr, mFlags);
|
||||
if (mFlags &FD_ENDIAN_SWAP)
|
||||
@@ -420,4 +432,5 @@ void btBulletFile::addStruct(const char* structType,void* data, int len, void* o
|
||||
|
||||
mLibPointers.insert(dataChunk.oldPtr, (bStructHandle*)data);
|
||||
m_chunks.push_back(dataChunk);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ subject to the following restrictions:
|
||||
#include "LinearMath/btAlignedObjectArray.h"
|
||||
#include "bDefines.h"
|
||||
|
||||
|
||||
#include "LinearMath/btSerializer.h"
|
||||
|
||||
|
||||
@@ -38,6 +39,8 @@ namespace bParse {
|
||||
|
||||
public:
|
||||
|
||||
btAlignedObjectArray<bStructHandle*> m_multiBodies;
|
||||
|
||||
btAlignedObjectArray<bStructHandle*> m_softBodies;
|
||||
|
||||
btAlignedObjectArray<bStructHandle*> m_rigidBodies;
|
||||
@@ -65,7 +68,7 @@ namespace bParse {
|
||||
|
||||
virtual void addDataBlock(char* dataBlock);
|
||||
|
||||
|
||||
|
||||
// experimental
|
||||
virtual int write(const char* fileName, bool fixupPointers=false);
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
project "BulletFileLoader"
|
||||
|
||||
kind "StaticLib"
|
||||
targetdir "../../lib"
|
||||
|
||||
includedirs {
|
||||
"../../../src"
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
project "BulletWorldImporter"
|
||||
|
||||
kind "StaticLib"
|
||||
targetdir "../../lib"
|
||||
|
||||
includedirs {
|
||||
"../BulletFileLoader",
|
||||
"../../../src"
|
||||
|
||||
@@ -188,6 +188,7 @@ char *includefiles[] = {
|
||||
"../../../src/BulletCollision/Gimpact/btGImpactShape.h",
|
||||
"../../../src/BulletCollision/CollisionShapes/btConvexHullShape.h",
|
||||
"../../../src/BulletCollision/CollisionDispatch/btCollisionObject.h",
|
||||
"../../../src/BulletDynamics/ConstraintSolver/btContactSolverInfo.h",
|
||||
"../../../src/BulletDynamics/Dynamics/btDynamicsWorld.h",
|
||||
"../../../src/BulletDynamics/Dynamics/btRigidBody.h",
|
||||
"../../../src/BulletDynamics/ConstraintSolver/btTypedConstraint.h",
|
||||
@@ -199,7 +200,7 @@ char *includefiles[] = {
|
||||
"../../../src/BulletDynamics/ConstraintSolver/btGeneric6DofSpring2Constraint.h",
|
||||
"../../../src/BulletDynamics/ConstraintSolver/btSliderConstraint.h",
|
||||
"../../../src/BulletDynamics/ConstraintSolver/btGearConstraint.h",
|
||||
"../../../src/BulletDynamics/ConstraintSolver/btContactSolverInfo.h",
|
||||
|
||||
"../../../src/BulletSoftBody/btSoftBodyData.h",
|
||||
"../../../src/BulletDynamics/Featherstone/btMultiBody.h",
|
||||
// empty string to indicate end of includefiles
|
||||
|
||||
Reference in New Issue
Block a user