vrshoot

view libs/assimp/ValidateDataStructure.h @ 1:e7ca128b8713

looks nice :)
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 02 Feb 2014 00:35:22 +0200
parents
children
line source
1 /*
2 Open Asset Import Library (assimp)
3 ----------------------------------------------------------------------
5 Copyright (c) 2006-2012, assimp team
6 All rights reserved.
8 Redistribution and use of this software in source and binary forms,
9 with or without modification, are permitted provided that the
10 following conditions are met:
12 * Redistributions of source code must retain the above
13 copyright notice, this list of conditions and the
14 following disclaimer.
16 * Redistributions in binary form must reproduce the above
17 copyright notice, this list of conditions and the
18 following disclaimer in the documentation and/or other
19 materials provided with the distribution.
21 * Neither the name of the assimp team, nor the names of its
22 contributors may be used to endorse or promote products
23 derived from this software without specific prior
24 written permission of the assimp team.
26 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
27 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
28 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
29 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
30 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
31 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
32 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
33 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
34 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
35 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
36 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38 ----------------------------------------------------------------------
39 */
41 /** @file Defines a (dummy) post processing step to validate the loader's
42 * output data structure (for debugging)
43 */
44 #ifndef AI_VALIDATEPROCESS_H_INC
45 #define AI_VALIDATEPROCESS_H_INC
47 #include "assimp/types.h"
48 #include "BaseProcess.h"
50 struct aiBone;
51 struct aiMesh;
52 struct aiAnimation;
53 struct aiNodeAnim;
54 struct aiTexture;
55 struct aiMaterial;
56 struct aiNode;
57 struct aiString;
59 namespace Assimp {
61 // --------------------------------------------------------------------------------------
62 /** Validates the whole ASSIMP scene data structure for correctness.
63 * ImportErrorException is thrown of the scene is corrupt.*/
64 // --------------------------------------------------------------------------------------
65 class ValidateDSProcess : public BaseProcess
66 {
67 public:
69 ValidateDSProcess();
70 ~ValidateDSProcess();
72 public:
73 // -------------------------------------------------------------------
74 bool IsActive( unsigned int pFlags) const;
76 // -------------------------------------------------------------------
77 void Execute( aiScene* pScene);
79 protected:
81 // -------------------------------------------------------------------
82 /** Report a validation error. This will throw an exception,
83 * control won't return.
84 * @param msg Format string for sprintf().*/
85 AI_WONT_RETURN void ReportError(const char* msg,...);
88 // -------------------------------------------------------------------
89 /** Report a validation warning. This won't throw an exception,
90 * control will return to the callera.
91 * @param msg Format string for sprintf().*/
92 void ReportWarning(const char* msg,...);
95 // -------------------------------------------------------------------
96 /** Validates a mesh
97 * @param pMesh Input mesh*/
98 void Validate( const aiMesh* pMesh);
100 // -------------------------------------------------------------------
101 /** Validates a bone
102 * @param pMesh Input mesh
103 * @param pBone Input bone*/
104 void Validate( const aiMesh* pMesh,const aiBone* pBone,float* afSum);
106 // -------------------------------------------------------------------
107 /** Validates an animation
108 * @param pAnimation Input animation*/
109 void Validate( const aiAnimation* pAnimation);
111 // -------------------------------------------------------------------
112 /** Validates a material
113 * @param pMaterial Input material*/
114 void Validate( const aiMaterial* pMaterial);
116 // -------------------------------------------------------------------
117 /** Search the material data structure for invalid or corrupt
118 * texture keys.
119 * @param pMaterial Input material
120 * @param type Type of the texture*/
121 void SearchForInvalidTextures(const aiMaterial* pMaterial,
122 aiTextureType type);
124 // -------------------------------------------------------------------
125 /** Validates a texture
126 * @param pTexture Input texture*/
127 void Validate( const aiTexture* pTexture);
129 // -------------------------------------------------------------------
130 /** Validates a light source
131 * @param pLight Input light
132 */
133 void Validate( const aiLight* pLight);
135 // -------------------------------------------------------------------
136 /** Validates a camera
137 * @param pCamera Input camera*/
138 void Validate( const aiCamera* pCamera);
140 // -------------------------------------------------------------------
141 /** Validates a bone animation channel
142 * @param pAnimation Animation channel.
143 * @param pBoneAnim Input bone animation */
144 void Validate( const aiAnimation* pAnimation,
145 const aiNodeAnim* pBoneAnim);
147 // -------------------------------------------------------------------
148 /** Validates a node and all of its subnodes
149 * @param Node Input node*/
150 void Validate( const aiNode* pNode);
152 // -------------------------------------------------------------------
153 /** Validates a string
154 * @param pString Input string*/
155 void Validate( const aiString* pString);
157 private:
159 // template to validate one of the aiScene::mXXX arrays
160 template <typename T>
161 inline void DoValidation(T** array, unsigned int size,
162 const char* firstName, const char* secondName);
164 // extended version: checks whethr T::mName occurs twice
165 template <typename T>
166 inline void DoValidationEx(T** array, unsigned int size,
167 const char* firstName, const char* secondName);
169 // extension to the first template which does also search
170 // the nodegraph for an item with the same name
171 template <typename T>
172 inline void DoValidationWithNameCheck(T** array, unsigned int size,
173 const char* firstName, const char* secondName);
175 aiScene* mScene;
176 };
181 } // end of namespace Assimp
183 #endif // AI_VALIDATEPROCESS_H_INC