vrshoot
view libs/assimp/HMPLoader.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 */
40 /** @file HMPLoader.h
41 * @brief Declaration of the HMP importer class
42 */
44 #ifndef AI_HMPLOADER_H_INCLUDED
45 #define AI_HMPLOADER_H_INCLUDED
47 // public ASSIMP headers
48 #include "assimp/types.h"
49 #include "assimp/texture.h"
50 #include "assimp/material.h"
52 // internal headers
53 #include "BaseImporter.h"
54 #include "MDLLoader.h"
55 #include "HMPFileData.h"
57 namespace Assimp {
58 using namespace HMP;
60 // ---------------------------------------------------------------------------
61 /** Used to load 3D GameStudio HMP files (terrains)
62 */
63 class HMPImporter : public MDLImporter
64 {
65 public:
66 HMPImporter();
67 ~HMPImporter();
70 public:
72 // -------------------------------------------------------------------
73 /** Returns whether the class can handle the format of the given file.
74 * See BaseImporter::CanRead() for details.
75 */
76 bool CanRead( const std::string& pFile, IOSystem* pIOHandler,
77 bool checkSig) const;
79 protected:
82 // -------------------------------------------------------------------
83 /** Return importer meta information.
84 * See #BaseImporter::GetInfo for the details
85 */
86 const aiImporterDesc* GetInfo () const;
88 // -------------------------------------------------------------------
89 /** Imports the given file into the given scene structure.
90 * See BaseImporter::InternReadFile() for details
91 */
92 void InternReadFile( const std::string& pFile, aiScene* pScene,
93 IOSystem* pIOHandler);
95 protected:
97 // -------------------------------------------------------------------
98 /** Import a HMP4 file
99 */
100 void InternReadFile_HMP4( );
102 // -------------------------------------------------------------------
103 /** Import a HMP5 file
104 */
105 void InternReadFile_HMP5( );
107 // -------------------------------------------------------------------
108 /** Import a HMP7 file
109 */
110 void InternReadFile_HMP7( );
112 // -------------------------------------------------------------------
113 /** Validate a HMP 5,4,7 file header
114 */
115 void ValidateHeader_HMP457( );
117 // -------------------------------------------------------------------
118 /** Try to load one material from the file, if this fails create
119 * a default material
120 */
121 void CreateMaterial(const unsigned char* szCurrent,
122 const unsigned char** szCurrentOut);
124 // -------------------------------------------------------------------
125 /** Build a list of output faces and vertices. The function
126 * triangulates the height map read from the file
127 * \param width Width of the height field
128 * \param width Height of the height field
129 */
130 void CreateOutputFaceList(unsigned int width,unsigned int height);
132 // -------------------------------------------------------------------
133 /** Generate planar texture coordinates for a terrain
134 * \param width Width of the terrain, in vertices
135 * \param height Height of the terrain, in vertices
136 */
137 void GenerateTextureCoords(const unsigned int width,
138 const unsigned int height);
140 // -------------------------------------------------------------------
141 /** Read the first skin from the file and skip all others ...
142 * \param iNumSkins Number of skins in the file
143 * \param szCursor Position of the first skin (offset 84)
144 */
145 void ReadFirstSkin(unsigned int iNumSkins, const unsigned char* szCursor,
146 const unsigned char** szCursorOut);
148 private:
150 };
152 } // end of namespace Assimp
154 #endif // AI_HMPIMPORTER_H_INC