16#ifndef BT_SERIALIZER_H
17#define BT_SERIALIZER_H
22#if !defined(__CELLOS_LV2__) && !defined(__MWERKS__)
101#define BT_HEADER_LENGTH 12
102#if defined(__sgi) || defined(__sparc) || defined(__sparc__) || defined(__PPC__) || defined(__ppc__) || defined(__BIG_ENDIAN__)
103#define BT_MAKE_ID(a, b, c, d) ((int)(a) << 24 | (int)(b) << 16 | (c) << 8 | (d))
105#define BT_MAKE_ID(a, b, c, d) ((int)(d) << 24 | (int)(c) << 16 | (b) << 8 | (a))
108#define BT_MULTIBODY_CODE BT_MAKE_ID('M', 'B', 'D', 'Y')
109#define BT_MB_LINKCOLLIDER_CODE BT_MAKE_ID('M', 'B', 'L', 'C')
110#define BT_SOFTBODY_CODE BT_MAKE_ID('S', 'B', 'D', 'Y')
111#define BT_COLLISIONOBJECT_CODE BT_MAKE_ID('C', 'O', 'B', 'J')
112#define BT_RIGIDBODY_CODE BT_MAKE_ID('R', 'B', 'D', 'Y')
113#define BT_CONSTRAINT_CODE BT_MAKE_ID('C', 'O', 'N', 'S')
114#define BT_BOXSHAPE_CODE BT_MAKE_ID('B', 'O', 'X', 'S')
115#define BT_QUANTIZED_BVH_CODE BT_MAKE_ID('Q', 'B', 'V', 'H')
116#define BT_TRIANLGE_INFO_MAP BT_MAKE_ID('T', 'M', 'A', 'P')
117#define BT_SHAPE_CODE BT_MAKE_ID('S', 'H', 'A', 'P')
118#define BT_ARRAY_CODE BT_MAKE_ID('A', 'R', 'A', 'Y')
119#define BT_SBMATERIAL_CODE BT_MAKE_ID('S', 'B', 'M', 'T')
120#define BT_SBNODE_CODE BT_MAKE_ID('S', 'B', 'N', 'D')
121#define BT_DYNAMICSWORLD_CODE BT_MAKE_ID('D', 'W', 'L', 'D')
122#define BT_CONTACTMANIFOLD_CODE BT_MAKE_ID('C', 'O', 'N', 'T')
123#define BT_DNA_CODE BT_MAKE_ID('D', 'N', 'A', '1')
344 for (
int a = 0; a < len; a++,
shtPtr += 2)
387 const bool VOID_IS_8 = ((
sizeof(
void*) == 8));
389#ifdef BT_INTERNAL_UPDATE_SERIALIZATION_STRUCTURES
429 const bool VOID_IS_8 = ((
sizeof(
void*) == 8));
439 const bool VOID_IS_8 = ((
sizeof(
void*) == 8));
455#ifdef BT_USE_DOUBLE_PRECISION
464 if (
sizeof(
void*) == 8)
590 unsigned char* ptr = 0;
610 unsigned char* data = ptr +
sizeof(
btChunk);
614 chunk->m_oldPtr = data;
654 for (
int i = 0; i < len; i++)
689#ifdef ENABLE_INMEMORY_SERIALIZER
740 return chunk->m_oldPtr;
744 const char* n = (
const char*)oldPtr;
752 void**
ptr2 = m_skipPointers[oldPtr];
779 m_chunkP.insert(oldPtr, oldPtr);
785 switch (
chunk->m_chunkCode)
789#ifdef BT_USE_DOUBLE_PRECISION
798#ifdef BT_USE_DOUBLE_PRECISION
807#ifdef BT_USE_DOUBLE_PRECISION
816#ifdef BT_USE_DOUBLE_PRECISION
825#ifdef BT_USE_DOUBLE_PRECISION
#define btAlignedFree(ptr)
#define btAlignedAlloc(size, alignment)
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
const T & btMax(const T &a, const T &b)
#define SIMD_FORCE_INLINE
unsigned btSwapEndian(unsigned val)
T * btAlignPointer(T *unalignedPtr, size_t alignment)
align a pointer to the provided alignment, upwards
@ BT_SERIALIZE_NO_DUPLICATE_ASSERT
@ BT_SERIALIZE_NO_TRIANGLEINFOMAP
@ BT_SERIALIZE_CONTACT_MANIFOLDS
#define BT_SBMATERIAL_CODE
#define BT_COLLISIONOBJECT_CODE
#define BT_TRIANLGE_INFO_MAP
#define BT_QUANTIZED_BVH_CODE
#define BT_RIGIDBODY_CODE
int btStrLen(const char *str)
#define BT_DYNAMICSWORLD_CODE
#define BT_CONSTRAINT_CODE
The btAlignedObjectArray template class uses a subset of the stl::vector interface for its methods It...
int size() const
return the number of elements in the array
void clear()
clear the array, deallocated memory. Generally it is better to use array.resize(0),...
void push_back(const T &_Val)
const T & at(int n) const
The btDefaultSerializer is the main Bullet serialization class.
void initDNA(const char *bdnaOrg, int dnalen)
virtual const char * findNameForPointer(const void *ptr) const
virtual void setSerializationFlags(int flags)
btHashMap< btHashPtr, void * > m_chunkP
btHashMap< btHashPtr, void * > m_skipPointers
btAlignedObjectArray< char * > mTypes
static const char * getMemoryDna()
virtual ~btDefaultSerializer()
virtual void * getUniquePointer(void *oldPtr)
virtual unsigned char * internalAlloc(size_t size)
btHashMap< btHashPtr, btPointerUid > m_uniquePointers
btAlignedObjectArray< btChunk * > m_chunkPtrs
virtual void * findPointer(void *oldPtr)
virtual void serializeName(const char *name)
virtual void startSerialization()
int getReverseType(const char *type) const
btAlignedObjectArray< short > mTlens
virtual int getSerializationFlags() const
const btChunk * getChunk(int chunkIndex) const
btHashMap< btHashPtr, const char * > m_nameMap
virtual void registerNameForPointer(const void *ptr, const char *name)
virtual int getCurrentBufferSize() const
virtual void finalizeChunk(btChunk *chunk, const char *structType, int chunkCode, void *oldPtr)
btHashMap< btHashInt, int > mStructReverse
virtual void finishSerialization()
btDefaultSerializer(int totalSize=0, unsigned char *buffer=0)
void writeHeader(unsigned char *buffer) const
btHashMap< btHashString, int > mTypeLookup
static int getMemoryDnaSizeInBytes()
virtual const unsigned char * getBufferPointer() const
btAlignedObjectArray< short * > mStructs
virtual btChunk * allocate(size_t size, int numElements)
The btHashMap template class implements a generic and lightweight hashmap.
void insert(const Key &key, const Value &value)
const Value * find(const Key &key) const
virtual btChunk * allocate(size_t size, int numElements)=0
virtual void setSerializationFlags(int flags)=0
virtual int getCurrentBufferSize() const =0
virtual void * getUniquePointer(void *oldPtr)=0
virtual int getSerializationFlags() const =0
virtual void serializeName(const char *ptr)=0
virtual void finishSerialization()=0
virtual const char * findNameForPointer(const void *ptr) const =0
virtual void startSerialization()=0
virtual const btChunk * getChunk(int chunkIndex) const =0
virtual int getNumChunks() const =0
virtual void finalizeChunk(btChunk *chunk, const char *structType, int chunkCode, void *oldPtr)=0
virtual const unsigned char * getBufferPointer() const =0
virtual void registerNameForPointer(const void *ptr, const char *name)=0
virtual void * findPointer(void *oldPtr)=0
btAlignedObjectArray< struct btQuantizedBvhDoubleData * > m_bvhsDouble
btAlignedObjectArray< struct btTypedConstraintData * > m_constraintData
btAlignedObjectArray< struct btRigidBodyDoubleData * > m_rigidBodyDataDouble
btAlignedObjectArray< struct btCollisionObjectFloatData * > m_collisionObjectDataFloat
btAlignedObjectArray< struct btSoftBodyDoubleData * > m_softBodyDoubleData
btAlignedObjectArray< struct btRigidBodyFloatData * > m_rigidBodyDataFloat
btAlignedObjectArray< struct btTypedConstraintDoubleData * > m_constraintDataDouble
btAlignedObjectArray< struct btDynamicsWorldDoubleData * > m_dynamicWorldInfoDataDouble
btAlignedObjectArray< struct btTypedConstraintFloatData * > m_constraintDataFloat
btAlignedObjectArray< struct btCollisionObjectDoubleData * > m_collisionObjectDataDouble
btAlignedObjectArray< struct btCollisionShapeData * > m_colShapeData
btAlignedObjectArray< struct btDynamicsWorldFloatData * > m_dynamicWorldInfoDataFloat
btBulletSerializedArrays()
btAlignedObjectArray< struct btQuantizedBvhFloatData * > m_bvhsFloat
btAlignedObjectArray< struct btSoftBodyFloatData * > m_softBodyFloatData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
very basic hashable string implementation, compatible with btHashMap
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64