MakeVerboseFormat.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. /*
  2. Open Asset Import Library (assimp)
  3. ----------------------------------------------------------------------
  4. Copyright (c) 2006-2020, assimp team
  5. All rights reserved.
  6. Redistribution and use of this software in source and binary forms,
  7. with or without modification, are permitted provided that the
  8. following conditions are met:
  9. * Redistributions of source code must retain the above
  10. copyright notice, this list of conditions and the
  11. following disclaimer.
  12. * Redistributions in binary form must reproduce the above
  13. copyright notice, this list of conditions and the
  14. following disclaimer in the documentation and/or other
  15. materials provided with the distribution.
  16. * Neither the name of the assimp team, nor the names of its
  17. contributors may be used to endorse or promote products
  18. derived from this software without specific prior
  19. written permission of the assimp team.
  20. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  21. "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  22. LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  23. A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  24. OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  25. SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  26. LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  27. DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  28. THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  29. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  30. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  31. ----------------------------------------------------------------------
  32. */
  33. /** @file Defines a post processing step to bring a given scene
  34. into the verbose format that is expected by most postprocess steps.
  35. This is the inverse of the "JoinIdenticalVertices" step. */
  36. #ifndef AI_MAKEVERBOSEFORMAT_H_INC
  37. #define AI_MAKEVERBOSEFORMAT_H_INC
  38. #include "Common/BaseProcess.h"
  39. struct aiMesh;
  40. namespace Assimp {
  41. // ---------------------------------------------------------------------------
  42. /** MakeVerboseFormatProcess: Class to convert an asset to the verbose
  43. * format which is expected by most postprocess steps.
  44. *
  45. * This is the inverse of what the "JoinIdenticalVertices" step is doing.
  46. * This step has no official flag (since it wouldn't make sense to run it
  47. * during import). It is intended for applications intending to modify the
  48. * returned aiScene. After this step has been executed, they can execute
  49. * other postprocess steps on the data. The code might also be useful to
  50. * quickly adapt code that doesn't result in a verbose representation of
  51. * the scene data.
  52. * The step has been added because it was required by the viewer, however
  53. * it has been moved to the main library since others might find it
  54. * useful, too. */
  55. class ASSIMP_API_WINONLY MakeVerboseFormatProcess : public BaseProcess
  56. {
  57. public:
  58. MakeVerboseFormatProcess();
  59. ~MakeVerboseFormatProcess();
  60. public:
  61. // -------------------------------------------------------------------
  62. /** Returns whether the processing step is present in the given flag field.
  63. * @param pFlags The processing flags the importer was called with. A bitwise
  64. * combination of #aiPostProcessSteps.
  65. * @return true if the process is present in this flag fields, false if not */
  66. bool IsActive( unsigned int /*pFlags*/ ) const
  67. {
  68. // NOTE: There is no direct flag that corresponds to
  69. // this postprocess step.
  70. return false;
  71. }
  72. // -------------------------------------------------------------------
  73. /** Executes the post processing step on the given imported data.
  74. * At the moment a process is not supposed to fail.
  75. * @param pScene The imported data to work at. */
  76. void Execute( aiScene* pScene);
  77. public:
  78. // -------------------------------------------------------------------
  79. /** Checks whether the scene is already in verbose format.
  80. * @param pScene The data to check.
  81. * @return true if the scene is already in verbose format. */
  82. static bool IsVerboseFormat(const aiScene* pScene);
  83. private:
  84. //! Apply the postprocess step to a given submesh
  85. bool MakeVerboseFormat (aiMesh* pcMesh);
  86. };
  87. } // end of namespace Assimp
  88. #endif // !!AI_KILLNORMALPROCESS_H_INC