vrshoot
diff libs/assimp/ValidateDataStructure.h @ 0:b2f14e535253
initial commit
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sat, 01 Feb 2014 19:58:19 +0200 |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/libs/assimp/ValidateDataStructure.h Sat Feb 01 19:58:19 2014 +0200 1.3 @@ -0,0 +1,183 @@ 1.4 +/* 1.5 +Open Asset Import Library (assimp) 1.6 +---------------------------------------------------------------------- 1.7 + 1.8 +Copyright (c) 2006-2012, assimp team 1.9 +All rights reserved. 1.10 + 1.11 +Redistribution and use of this software in source and binary forms, 1.12 +with or without modification, are permitted provided that the 1.13 +following conditions are met: 1.14 + 1.15 +* Redistributions of source code must retain the above 1.16 + copyright notice, this list of conditions and the 1.17 + following disclaimer. 1.18 + 1.19 +* Redistributions in binary form must reproduce the above 1.20 + copyright notice, this list of conditions and the 1.21 + following disclaimer in the documentation and/or other 1.22 + materials provided with the distribution. 1.23 + 1.24 +* Neither the name of the assimp team, nor the names of its 1.25 + contributors may be used to endorse or promote products 1.26 + derived from this software without specific prior 1.27 + written permission of the assimp team. 1.28 + 1.29 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 1.30 +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 1.31 +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 1.32 +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 1.33 +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 1.34 +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 1.35 +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 1.36 +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 1.37 +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 1.38 +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 1.39 +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 1.40 + 1.41 +---------------------------------------------------------------------- 1.42 +*/ 1.43 + 1.44 +/** @file Defines a (dummy) post processing step to validate the loader's 1.45 + * output data structure (for debugging) 1.46 + */ 1.47 +#ifndef AI_VALIDATEPROCESS_H_INC 1.48 +#define AI_VALIDATEPROCESS_H_INC 1.49 + 1.50 +#include "assimp/types.h" 1.51 +#include "BaseProcess.h" 1.52 + 1.53 +struct aiBone; 1.54 +struct aiMesh; 1.55 +struct aiAnimation; 1.56 +struct aiNodeAnim; 1.57 +struct aiTexture; 1.58 +struct aiMaterial; 1.59 +struct aiNode; 1.60 +struct aiString; 1.61 + 1.62 +namespace Assimp { 1.63 + 1.64 +// -------------------------------------------------------------------------------------- 1.65 +/** Validates the whole ASSIMP scene data structure for correctness. 1.66 + * ImportErrorException is thrown of the scene is corrupt.*/ 1.67 +// -------------------------------------------------------------------------------------- 1.68 +class ValidateDSProcess : public BaseProcess 1.69 +{ 1.70 +public: 1.71 + 1.72 + ValidateDSProcess(); 1.73 + ~ValidateDSProcess(); 1.74 + 1.75 +public: 1.76 + // ------------------------------------------------------------------- 1.77 + bool IsActive( unsigned int pFlags) const; 1.78 + 1.79 + // ------------------------------------------------------------------- 1.80 + void Execute( aiScene* pScene); 1.81 + 1.82 +protected: 1.83 + 1.84 + // ------------------------------------------------------------------- 1.85 + /** Report a validation error. This will throw an exception, 1.86 + * control won't return. 1.87 + * @param msg Format string for sprintf().*/ 1.88 + AI_WONT_RETURN void ReportError(const char* msg,...); 1.89 + 1.90 + 1.91 + // ------------------------------------------------------------------- 1.92 + /** Report a validation warning. This won't throw an exception, 1.93 + * control will return to the callera. 1.94 + * @param msg Format string for sprintf().*/ 1.95 + void ReportWarning(const char* msg,...); 1.96 + 1.97 + 1.98 + // ------------------------------------------------------------------- 1.99 + /** Validates a mesh 1.100 + * @param pMesh Input mesh*/ 1.101 + void Validate( const aiMesh* pMesh); 1.102 + 1.103 + // ------------------------------------------------------------------- 1.104 + /** Validates a bone 1.105 + * @param pMesh Input mesh 1.106 + * @param pBone Input bone*/ 1.107 + void Validate( const aiMesh* pMesh,const aiBone* pBone,float* afSum); 1.108 + 1.109 + // ------------------------------------------------------------------- 1.110 + /** Validates an animation 1.111 + * @param pAnimation Input animation*/ 1.112 + void Validate( const aiAnimation* pAnimation); 1.113 + 1.114 + // ------------------------------------------------------------------- 1.115 + /** Validates a material 1.116 + * @param pMaterial Input material*/ 1.117 + void Validate( const aiMaterial* pMaterial); 1.118 + 1.119 + // ------------------------------------------------------------------- 1.120 + /** Search the material data structure for invalid or corrupt 1.121 + * texture keys. 1.122 + * @param pMaterial Input material 1.123 + * @param type Type of the texture*/ 1.124 + void SearchForInvalidTextures(const aiMaterial* pMaterial, 1.125 + aiTextureType type); 1.126 + 1.127 + // ------------------------------------------------------------------- 1.128 + /** Validates a texture 1.129 + * @param pTexture Input texture*/ 1.130 + void Validate( const aiTexture* pTexture); 1.131 + 1.132 + // ------------------------------------------------------------------- 1.133 + /** Validates a light source 1.134 + * @param pLight Input light 1.135 + */ 1.136 + void Validate( const aiLight* pLight); 1.137 + 1.138 + // ------------------------------------------------------------------- 1.139 + /** Validates a camera 1.140 + * @param pCamera Input camera*/ 1.141 + void Validate( const aiCamera* pCamera); 1.142 + 1.143 + // ------------------------------------------------------------------- 1.144 + /** Validates a bone animation channel 1.145 + * @param pAnimation Animation channel. 1.146 + * @param pBoneAnim Input bone animation */ 1.147 + void Validate( const aiAnimation* pAnimation, 1.148 + const aiNodeAnim* pBoneAnim); 1.149 + 1.150 + // ------------------------------------------------------------------- 1.151 + /** Validates a node and all of its subnodes 1.152 + * @param Node Input node*/ 1.153 + void Validate( const aiNode* pNode); 1.154 + 1.155 + // ------------------------------------------------------------------- 1.156 + /** Validates a string 1.157 + * @param pString Input string*/ 1.158 + void Validate( const aiString* pString); 1.159 + 1.160 +private: 1.161 + 1.162 + // template to validate one of the aiScene::mXXX arrays 1.163 + template <typename T> 1.164 + inline void DoValidation(T** array, unsigned int size, 1.165 + const char* firstName, const char* secondName); 1.166 + 1.167 + // extended version: checks whethr T::mName occurs twice 1.168 + template <typename T> 1.169 + inline void DoValidationEx(T** array, unsigned int size, 1.170 + const char* firstName, const char* secondName); 1.171 + 1.172 + // extension to the first template which does also search 1.173 + // the nodegraph for an item with the same name 1.174 + template <typename T> 1.175 + inline void DoValidationWithNameCheck(T** array, unsigned int size, 1.176 + const char* firstName, const char* secondName); 1.177 + 1.178 + aiScene* mScene; 1.179 +}; 1.180 + 1.181 + 1.182 + 1.183 + 1.184 +} // end of namespace Assimp 1.185 + 1.186 +#endif // AI_VALIDATEPROCESS_H_INC