You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

207 line
5.9 KiB

  1. /*
  2. ---------------------------------------------------------------------------
  3. Open Asset Import Library (assimp)
  4. ---------------------------------------------------------------------------
  5. Copyright (c) 2006-2012, assimp team
  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 following
  9. 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 Main.h
  35. * @brief Utility declarations for assimp_cmd
  36. */
  37. #ifndef AICMD_MAIN_INCLUDED
  38. #define AICMD_MAIN_INCLUDED
  39. #define _CRT_SECURE_NO_WARNINGS
  40. #include <stdio.h>
  41. #include <string.h>
  42. #include <time.h>
  43. #include <limits>
  44. #include <assimp/postprocess.h>
  45. #include <assimp/version.h>
  46. #include <assimp/scene.h>
  47. #include <assimp/Importer.hpp>
  48. #include <assimp/DefaultLogger.hpp>
  49. #ifndef ASSIMP_BUILD_NO_EXPORT
  50. # include <assimp/Exporter.hpp>
  51. #endif
  52. #include <../code/AssimpPCH.h> /* to get stdint.h */
  53. #ifdef ASSIMP_BUILD_NO_OWN_ZLIB
  54. #include <zlib.h>
  55. #else
  56. #include <../contrib/zlib/zlib.h>
  57. #endif
  58. #ifndef SIZE_MAX
  59. # define SIZE_MAX (std::numeric_limits<size_t>::max())
  60. #endif
  61. using namespace Assimp;
  62. // Global assimp importer instance
  63. extern Assimp::Importer* globalImporter;
  64. #ifndef ASSIMP_BUILD_NO_EXPORT
  65. // Global assimp exporter instance
  66. extern Assimp::Exporter* globalExporter;
  67. #endif
  68. // ------------------------------------------------------------------------------
  69. /** Defines common import parameters */
  70. struct ImportData
  71. {
  72. ImportData()
  73. : ppFlags (0)
  74. , showLog (false)
  75. , verbose (false)
  76. , log (false)
  77. {}
  78. /** Postprocessing flags
  79. */
  80. unsigned int ppFlags;
  81. // Log to std::err?
  82. bool showLog;
  83. // Log file
  84. std::string logFile;
  85. // Verbose log mode?
  86. bool verbose;
  87. // Need to log?
  88. bool log;
  89. };
  90. // ------------------------------------------------------------------------------
  91. /** Process standard arguments
  92. *
  93. * @param fill Filled by function
  94. * @param params Command line parameters to be processed
  95. * @param num NUmber of params
  96. * @return 0 for success */
  97. int ProcessStandardArguments(ImportData& fill,
  98. const char* const* params,
  99. unsigned int num);
  100. // ------------------------------------------------------------------------------
  101. /** Import a specific model file
  102. * @param imp Import configuration to be used
  103. * @param path Path to the file to be read */
  104. const aiScene* ImportModel(
  105. const ImportData& imp,
  106. const std::string& path);
  107. #ifndef ASSIMP_BUILD_NO_EXPORT
  108. // ------------------------------------------------------------------------------
  109. /** Export a specific model file
  110. * @param imp Import configuration to be used
  111. * @param path Path to the file to be written
  112. * @param format Format id*/
  113. bool ExportModel(const aiScene* pOut,
  114. const ImportData& imp,
  115. const std::string& path,
  116. const char* pID);
  117. #endif
  118. // ------------------------------------------------------------------------------
  119. /** assimp_dump utility
  120. * @param params Command line parameters to 'assimp dumb'
  121. * @param Number of params
  122. * @return 0 for success*/
  123. int Assimp_Dump (
  124. const char* const* params,
  125. unsigned int num);
  126. // ------------------------------------------------------------------------------
  127. /** assimp_export utility
  128. * @param params Command line parameters to 'assimp export'
  129. * @param Number of params
  130. * @return 0 for success*/
  131. int Assimp_Export (
  132. const char* const* params,
  133. unsigned int num);
  134. // ------------------------------------------------------------------------------
  135. /** assimp_extract utility
  136. * @param params Command line parameters to 'assimp extract'
  137. * @param Number of params
  138. * @return 0 for success*/
  139. int Assimp_Extract (
  140. const char* const* params,
  141. unsigned int num);
  142. // ------------------------------------------------------------------------------
  143. /** assimp_cmpdump utility
  144. * @param params Command line parameters to 'assimp cmpdump'
  145. * @param Number of params
  146. * @return 0 for success*/
  147. int Assimp_CompareDump (
  148. const char* const* params,
  149. unsigned int num);
  150. // ------------------------------------------------------------------------------
  151. /** @brief assimp info utility
  152. * @param params Command line parameters to 'assimp info'
  153. * @param Number of params
  154. * @return 0 for success */
  155. int Assimp_Info (
  156. const char* const* params,
  157. unsigned int num);
  158. // ------------------------------------------------------------------------------
  159. /** @brief assimp testbatchload utility
  160. * @param params Command line parameters to 'assimp testbatchload'
  161. * @param Number of params
  162. * @return 0 for success */
  163. int Assimp_TestBatchLoad (
  164. const char* const* params,
  165. unsigned int num);
  166. #endif // !! AICMD_MAIN_INCLUDED