b3BulletFile.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*
  2. bParse
  3. Copyright (c) 2006-2010 Charlie C & Erwin Coumans http://gamekit.googlecode.com
  4. This software is provided 'as-is', without any express or implied warranty.
  5. In no event will the authors be held liable for any damages arising from the use of this software.
  6. Permission is granted to anyone to use this software for any purpose,
  7. including commercial applications, and to alter it and redistribute it freely,
  8. subject to the following restrictions:
  9. 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.
  10. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
  11. 3. This notice may not be removed or altered from any source distribution.
  12. */
  13. #ifndef B3_BULLET_FILE_H
  14. #define B3_BULLET_FILE_H
  15. #include "b3File.h"
  16. #include "Bullet3Common/b3AlignedObjectArray.h"
  17. #include "b3Defines.h"
  18. #include "Bullet3Serialize/Bullet2FileLoader/b3Serializer.h"
  19. namespace bParse
  20. {
  21. // ----------------------------------------------------- //
  22. class b3BulletFile : public bFile
  23. {
  24. protected:
  25. char* m_DnaCopy;
  26. public:
  27. b3AlignedObjectArray<bStructHandle*> m_softBodies;
  28. b3AlignedObjectArray<bStructHandle*> m_rigidBodies;
  29. b3AlignedObjectArray<bStructHandle*> m_collisionObjects;
  30. b3AlignedObjectArray<bStructHandle*> m_collisionShapes;
  31. b3AlignedObjectArray<bStructHandle*> m_constraints;
  32. b3AlignedObjectArray<bStructHandle*> m_bvhs;
  33. b3AlignedObjectArray<bStructHandle*> m_triangleInfoMaps;
  34. b3AlignedObjectArray<bStructHandle*> m_dynamicsWorldInfo;
  35. b3AlignedObjectArray<char*> m_dataBlocks;
  36. b3BulletFile();
  37. b3BulletFile(const char* fileName);
  38. b3BulletFile(char* memoryBuffer, int len);
  39. virtual ~b3BulletFile();
  40. virtual void addDataBlock(char* dataBlock);
  41. // experimental
  42. virtual int write(const char* fileName, bool fixupPointers = false);
  43. virtual void parse(int verboseMode);
  44. virtual void parseData();
  45. virtual void writeDNA(FILE* fp);
  46. void addStruct(const char* structType, void* data, int len, void* oldPtr, int code);
  47. };
  48. }; // namespace bParse
  49. #endif //B3_BULLET_FILE_H