ValidateDataStructure.h 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. /*
  2. Open Asset Import Library (ASSIMP)
  3. ----------------------------------------------------------------------
  4. Copyright (c) 2006-2008, ASSIMP Development 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 Development 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 validate the loader's
  34. * output data structure (for debugging)
  35. */
  36. #ifndef AI_VALIDATEPROCESS_H_INC
  37. #define AI_VALIDATEPROCESS_H_INC
  38. #include "../include/aiTypes.h"
  39. #include "BaseProcess.h"
  40. struct aiBone;
  41. struct aiMesh;
  42. struct aiAnimation;
  43. struct aiBoneAnim;
  44. struct aiTexture;
  45. struct aiMaterial;
  46. struct aiNode;
  47. struct aiString;
  48. namespace Assimp
  49. {
  50. // ---------------------------------------------------------------------------
  51. /** Validates the ASSIMP data structure
  52. */
  53. class ASSIMP_API ValidateDSProcess : public BaseProcess
  54. {
  55. friend class Importer;
  56. protected:
  57. /** Constructor to be privately used by Importer */
  58. ValidateDSProcess();
  59. /** Destructor, private as well */
  60. ~ValidateDSProcess();
  61. public:
  62. // -------------------------------------------------------------------
  63. /** Returns whether the processing step is present in the given flag field.
  64. * @param pFlags The processing flags the importer was called with. A bitwise
  65. * combination of #aiPostProcessSteps.
  66. * @return true if the process is present in this flag fields, false if not.
  67. */
  68. bool IsActive( unsigned int pFlags) const;
  69. // -------------------------------------------------------------------
  70. /** Executes the post processing step on the given imported data.
  71. * A process should throw an ImportErrorException* if it fails.
  72. * @param pScene The imported data to work at.
  73. */
  74. void Execute( aiScene* pScene);
  75. protected:
  76. // -------------------------------------------------------------------
  77. /** Report a validation error. This will throw an exception,
  78. * control won't return.
  79. * @param msg Format string for sprintf().
  80. */
  81. void ReportError(const char* msg,...);
  82. // -------------------------------------------------------------------
  83. /** Report a validation warning. This won't throw an exception,
  84. * control will return to the callera.
  85. * @param msg Format string for sprintf().
  86. */
  87. void ReportWarning(const char* msg,...);
  88. // -------------------------------------------------------------------
  89. /** Validates a mesh
  90. * @param pMesh Input mesh
  91. */
  92. void Validate( const aiMesh* pMesh);
  93. // -------------------------------------------------------------------
  94. /** Validates a bone
  95. * @param pMesh Input mesh
  96. * @param pBone Input bone
  97. */
  98. void Validate( const aiMesh* pMesh,const aiBone* pBone,float* afSum);
  99. // -------------------------------------------------------------------
  100. /** Validates an animation
  101. * @param pAnimation Input animation
  102. */
  103. void Validate( const aiAnimation* pAnimation);
  104. // -------------------------------------------------------------------
  105. /** Validates a material
  106. * @param pMaterial Input material
  107. */
  108. void Validate( const aiMaterial* pMaterial);
  109. // -------------------------------------------------------------------
  110. /** Search the material data structure for invalid or corrupt
  111. * texture keys.
  112. * @param pMaterial Input material
  113. * @param szType Type of the texture (the purpose string that
  114. * occurs in material keys, e.g. "diffuse", "ambient")
  115. */
  116. void SearchForInvalidTextures(const aiMaterial* pMaterial,
  117. const char* szType);
  118. // -------------------------------------------------------------------
  119. /** Validates a texture
  120. * @param pTexture Input texture
  121. */
  122. void Validate( const aiTexture* pTexture);
  123. // -------------------------------------------------------------------
  124. /** Validates a bone animation channel
  125. * @param pAnimation Input animation
  126. * @param pBoneAnim Input bone animation
  127. */
  128. void Validate( const aiAnimation* pAnimation,
  129. const aiBoneAnim* pBoneAnim);
  130. // -------------------------------------------------------------------
  131. /** Validates a node and all of its subnodes
  132. * @param Node Input node
  133. */
  134. void Validate( const aiNode* pNode);
  135. // -------------------------------------------------------------------
  136. /** Validates a string
  137. * @param pString Input string
  138. */
  139. void Validate( const aiString* pString);
  140. private:
  141. aiScene* mScene;
  142. };
  143. } // end of namespace Assimp
  144. #endif // AI_VALIDATEPROCESS_H_INC