vrshoot

view libs/assimp/MD5Loader.h @ 2:334d17aed7de

visual studio project files
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 02 Feb 2014 18:36:38 +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 */
42 /** @file MD5Loader.h
43 * @brief Definition of the .MD5 importer class.
44 * http://www.modwiki.net/wiki/MD5_(file_format)
45 */
46 #ifndef AI_MD5LOADER_H_INCLUDED
47 #define AI_MD5LOADER_H_INCLUDED
49 #include "BaseImporter.h"
50 #include "MD5Parser.h"
52 #include "assimp/types.h"
54 namespace Assimp {
56 class IOStream;
57 using namespace Assimp::MD5;
59 // ---------------------------------------------------------------------------
60 /** Importer class for the MD5 file format
61 */
62 class MD5Importer : public BaseImporter
63 {
64 public:
65 MD5Importer();
66 ~MD5Importer();
69 public:
71 // -------------------------------------------------------------------
72 /** Returns whether the class can handle the format of the given file.
73 * See BaseImporter::CanRead() for details.
74 */
75 bool CanRead( const std::string& pFile, IOSystem* pIOHandler,
76 bool checkSig) const;
78 protected:
80 // -------------------------------------------------------------------
81 /** Return importer meta information.
82 * See #BaseImporter::GetInfo for the details
83 */
84 const aiImporterDesc* GetInfo () const;
86 // -------------------------------------------------------------------
87 /** Called prior to ReadFile().
88 * The function is a request to the importer to update its configuration
89 * basing on the Importer's configuration property list.
90 */
91 void SetupProperties(const Importer* pImp);
93 // -------------------------------------------------------------------
94 /** Imports the given file into the given scene structure.
95 * See BaseImporter::InternReadFile() for details
96 */
97 void InternReadFile( const std::string& pFile, aiScene* pScene,
98 IOSystem* pIOHandler);
100 protected:
103 // -------------------------------------------------------------------
104 /** Load a *.MD5MESH file.
105 */
106 void LoadMD5MeshFile ();
108 // -------------------------------------------------------------------
109 /** Load a *.MD5ANIM file.
110 */
111 void LoadMD5AnimFile ();
113 // -------------------------------------------------------------------
114 /** Load a *.MD5CAMERA file.
115 */
116 void LoadMD5CameraFile ();
118 // -------------------------------------------------------------------
119 /** Construct node hierarchy from a given MD5ANIM
120 * @param iParentID Current parent ID
121 * @param piParent Parent node to attach to
122 * @param bones Input bones
123 * @param node_anims Generated node animations
124 */
125 void AttachChilds_Anim(int iParentID,aiNode* piParent,
126 AnimBoneList& bones,const aiNodeAnim** node_anims);
128 // -------------------------------------------------------------------
129 /** Construct node hierarchy from a given MD5MESH
130 * @param iParentID Current parent ID
131 * @param piParent Parent node to attach to
132 * @param bones Input bones
133 */
134 void AttachChilds_Mesh(int iParentID,aiNode* piParent,BoneList& bones);
136 // -------------------------------------------------------------------
137 /** Build unique vertex buffers from a given MD5ANIM
138 * @param meshSrc Input data
139 */
140 void MakeDataUnique (MD5::MeshDesc& meshSrc);
142 // -------------------------------------------------------------------
143 /** Load the contents of a specific file into memory and
144 * alocates a buffer to keep it.
145 *
146 * mBuffer is modified to point to this buffer.
147 * @param pFile File stream to be read
148 */
149 void LoadFileIntoMemory (IOStream* pFile);
150 void UnloadFileFromMemory ();
153 /** IOSystem to be used to access files */
154 IOSystem* mIOHandler;
156 /** Path to the file, excluding the file extension but
157 with the dot */
158 std::string mFile;
160 /** Buffer to hold the loaded file */
161 char* mBuffer;
163 /** Size of the file */
164 unsigned int fileSize;
166 /** Current line number. For debugging purposes */
167 unsigned int iLineNumber;
169 /** Scene to be filled */
170 aiScene* pScene;
172 /** (Custom) I/O handler implementation */
173 IOSystem* pIOHandler;
175 /** true if a MD5MESH file has already been parsed */
176 bool bHadMD5Mesh;
178 /** true if a MD5ANIM file has already been parsed */
179 bool bHadMD5Anim;
181 /** true if a MD5CAMERA file has already been parsed */
182 bool bHadMD5Camera;
184 /** configuration option: prevent anim autoload */
185 bool configNoAutoLoad;
186 };
188 } // end of namespace Assimp
190 #endif // AI_3DSIMPORTER_H_INC