M3DExporter.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /*
  2. Open Asset Import Library (assimp)
  3. ----------------------------------------------------------------------
  4. Copyright (c) 2006-2025, assimp team
  5. Copyright (c) 2019 bzt
  6. All rights reserved.
  7. Redistribution and use of this software in source and binary forms,
  8. with or without modification, are permitted provided that the
  9. following conditions are met:
  10. * Redistributions of source code must retain the above
  11. copyright notice, this list of conditions and the
  12. following disclaimer.
  13. * Redistributions in binary form must reproduce the above
  14. copyright notice, this list of conditions and the
  15. following disclaimer in the documentation and/or other
  16. materials provided with the distribution.
  17. * Neither the name of the assimp team, nor the names of its
  18. contributors may be used to endorse or promote products
  19. derived from this software without specific prior
  20. written permission of the assimp team.
  21. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  22. "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  23. LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  24. A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  25. OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  26. SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  27. LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  28. DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  29. THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  30. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  31. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  32. ----------------------------------------------------------------------
  33. */
  34. /** @file M3DExporter.h
  35. * @brief Declares the exporter class to write a scene to a Model 3D file
  36. */
  37. #ifndef AI_M3DEXPORTER_H_INC
  38. #define AI_M3DEXPORTER_H_INC
  39. #ifndef ASSIMP_BUILD_NO_M3D_IMPORTER
  40. #ifndef ASSIMP_BUILD_NO_M3D_EXPORTER
  41. #include <assimp/types.h>
  42. #include <assimp/StreamWriter.h> // StreamWriterLE
  43. #include <assimp/Exceptional.h> // DeadlyExportError
  44. #include <memory> // shared_ptr
  45. struct aiScene;
  46. struct aiNode;
  47. struct aiMaterial;
  48. struct aiFace;
  49. namespace Assimp {
  50. class IOSystem;
  51. class IOStream;
  52. class ExportProperties;
  53. class M3DWrapper;
  54. // ---------------------------------------------------------------------
  55. /** Helper class to export a given scene to an M3D file. */
  56. // ---------------------------------------------------------------------
  57. class M3DExporter {
  58. public:
  59. /// Constructor for a specific scene to export
  60. M3DExporter(const aiScene* pScene, const ExportProperties* pProperties);
  61. // call this to do the actual export
  62. void doExport(const char* pFile, IOSystem* pIOSystem, bool toAscii);
  63. private:
  64. const aiScene* mScene; // the scene to export
  65. const ExportProperties* mProperties; // currently unused
  66. std::shared_ptr<IOStream> outfile; // file to write to
  67. // helper to do the recursive walking
  68. void NodeWalk(const M3DWrapper &m3d, const aiNode* pNode, aiMatrix4x4 m);
  69. };
  70. }
  71. #endif // #ifndef ASSIMP_BUILD_NO_M3D_IMPORTER
  72. #endif // ASSIMP_BUILD_NO_M3D_EXPORTER
  73. #endif // AI_M3DEXPORTER_H_INC