1 /* 2 Open Asset Import Library (assimp) 3 ---------------------------------------------------------------------- 4 5 Copyright (c) 2006-2021, assimp team 6 7 8 All rights reserved. 9 10 Redistribution and use of this software in source and binary forms, 11 with or without modification, are permitted provided that the 12 following conditions are met: 13 14 * Redistributions of source code must retain the above 15 copyright notice, this list of conditions and the 16 following disclaimer. 17 18 * Redistributions in binary form must reproduce the above 19 copyright notice, this list of conditions and the 20 following disclaimer in the documentation and/or other 21 materials provided with the distribution. 22 23 * Neither the name of the assimp team, nor the names of its 24 contributors may be used to endorse or promote products 25 derived from this software without specific prior 26 written permission of the assimp team. 27 28 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 29 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 30 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 31 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 32 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 33 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 34 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 35 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 36 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 37 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 38 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 39 40 ---------------------------------------------------------------------- 41 */ 42 43 /** @file MDCLoader.h 44 * @brief Definition of the MDC importer class. 45 */ 46 #ifndef AI_MDCLOADER_H_INCLUDED 47 #define AI_MDCLOADER_H_INCLUDED 48 49 #include <assimp/types.h> 50 51 #include "MDCFileData.h" 52 #include <assimp/BaseImporter.h> 53 #include <assimp/ByteSwapper.h> 54 55 namespace Assimp { 56 57 using namespace MDC; 58 59 // --------------------------------------------------------------------------- 60 /** Importer class to load the RtCW MDC file format 61 */ 62 class MDCImporter : public BaseImporter { 63 public: 64 MDCImporter(); 65 ~MDCImporter() override; 66 67 // ------------------------------------------------------------------- 68 /** Returns whether the class can handle the format of the given file. 69 * See BaseImporter::CanRead() for details. */ 70 bool CanRead(const std::string &pFile, IOSystem *pIOHandler, 71 bool checkSig) const override; 72 73 // ------------------------------------------------------------------- 74 /** Called prior to ReadFile(). 75 * The function is a request to the importer to update its configuration 76 * basing on the Importer's configuration property list. 77 */ 78 void SetupProperties(const Importer *pImp) override; 79 80 protected: 81 // ------------------------------------------------------------------- 82 /** Return importer meta information. 83 * See #BaseImporter::GetInfo for the details 84 */ 85 const aiImporterDesc *GetInfo() const override; 86 87 // ------------------------------------------------------------------- 88 /** Imports the given file into the given scene structure. 89 * See BaseImporter::InternReadFile() for details 90 */ 91 void InternReadFile(const std::string &pFile, aiScene *pScene, 92 IOSystem *pIOHandler) override; 93 94 // ------------------------------------------------------------------- 95 /** Validate the header of the file 96 */ 97 void ValidateHeader(); 98 99 // ------------------------------------------------------------------- 100 /** Validate the header of a MDC surface 101 */ 102 void ValidateSurfaceHeader(BE_NCONST MDC::Surface *pcSurf); 103 104 protected: 105 /** Configuration option: frame to be loaded */ 106 unsigned int configFrameID; 107 108 /** Header of the MDC file */ 109 BE_NCONST MDC::Header *pcHeader; 110 111 /** Buffer to hold the loaded file */ 112 unsigned char *mBuffer; 113 114 /** size of the file, in bytes */ 115 unsigned int fileSize; 116 }; 117 118 } // end of namespace Assimp 119 120 #endif // AI_3DSIMPORTER_H_INC 121