1 /*
2 Open Asset Import Library (assimp)
3 ----------------------------------------------------------------------
4 
5 Copyright (c) 2006-2016, assimp team
6 All rights reserved.
7 
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:
11 
12 * Redistributions of source code must retain the above
13   copyright notice, this list of conditions and the
14   following disclaimer.
15 
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.
20 
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.
25 
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.
37 
38 ----------------------------------------------------------------------
39 */
40 //!
41 //! @file Data structures for the 3D Game Studio Heightmap format (HMP)
42 //!
43 
44 namespace Assimp    {
45 namespace HMP   {
46 
47 #include "./../include/assimp/Compiler/pushpack1.h"
48 #include <stdint.h>
49 
50 // to make it easier for us, we test the magic word against both "endianesses"
51 #define AI_HMP_MAGIC_NUMBER_BE_4    AI_MAKE_MAGIC("HMP4")
52 #define AI_HMP_MAGIC_NUMBER_LE_4    AI_MAKE_MAGIC("4PMH")
53 
54 #define AI_HMP_MAGIC_NUMBER_BE_5    AI_MAKE_MAGIC("HMP5")
55 #define AI_HMP_MAGIC_NUMBER_LE_5    AI_MAKE_MAGIC("5PMH")
56 
57 #define AI_HMP_MAGIC_NUMBER_BE_7    AI_MAKE_MAGIC("HMP7")
58 #define AI_HMP_MAGIC_NUMBER_LE_7    AI_MAKE_MAGIC("7PMH")
59 
60 // ---------------------------------------------------------------------------
61 /** Data structure for the header of a HMP5 file.
62  *  This is also used by HMP4 and HMP7, but with modifications
63 */
64 struct Header_HMP5
65 {
66     int8_t  ident[4]; // "HMP5"
67     int32_t     version;
68 
69     // ignored
70     float   scale[3];
71     float   scale_origin[3];
72     float   boundingradius;
73 
74     //! Size of one triangle in x direction
75     float   ftrisize_x;
76     //! Size of one triangle in y direction
77     float   ftrisize_y;
78     //! Number of vertices in x direction
79     float   fnumverts_x;
80 
81     //! Number of skins in the file
82     int32_t     numskins;
83 
84     // can ignore this?
85     int32_t     skinwidth;
86     int32_t     skinheight;
87 
88     //!Number of vertices in the file
89     int32_t     numverts;
90 
91     // ignored and zero
92     int32_t     numtris;
93 
94     //! only one supported ...
95     int32_t     numframes;
96 
97     //! Always 0 ...
98     int32_t     num_stverts;
99     int32_t     flags;
100     float   size;
101 } PACK_STRUCT;
102 
103 // ---------------------------------------------------------------------------
104 /** Data structure for a terrain vertex in a HMP4 file
105 */
106 struct Vertex_HMP4
107 {
108     uint16_t p_pos[3];
109     uint8_t normals162index;
110     uint8_t pad;
111 } PACK_STRUCT;
112 
113 // ---------------------------------------------------------------------------
114 /** Data structure for a terrain vertex in a HMP5 file
115 */
116 struct Vertex_HMP5
117 {
118     uint16_t z;
119     uint8_t normals162index;
120     uint8_t pad;
121 } PACK_STRUCT;
122 
123 // ---------------------------------------------------------------------------
124 /** Data structure for a terrain vertex in a HMP7 file
125 */
126 struct Vertex_HMP7
127 {
128     uint16_t     z;
129     int8_t normal_x,normal_y;
130 } PACK_STRUCT;
131 
132 #include "./../include/assimp/Compiler/poppack1.h"
133 
134 } //! namespace HMP
135 } //! namespace Assimp
136