/src/assimp/code/AssetLib/LWO/LWOFileData.h
Line | Count | Source |
1 | | /* |
2 | | Open Asset Import Library (assimp) |
3 | | ---------------------------------------------------------------------- |
4 | | |
5 | | Copyright (c) 2006-2025, assimp team |
6 | | |
7 | | All rights reserved. |
8 | | |
9 | | Redistribution and use of this software in source and binary forms, |
10 | | with or without modification, are permitted provided that the |
11 | | following conditions are met: |
12 | | |
13 | | * Redistributions of source code must retain the above |
14 | | copyright notice, this list of conditions and the |
15 | | following disclaimer. |
16 | | |
17 | | * Redistributions in binary form must reproduce the above |
18 | | copyright notice, this list of conditions and the |
19 | | following disclaimer in the documentation and/or other |
20 | | materials provided with the distribution. |
21 | | |
22 | | * Neither the name of the assimp team, nor the names of its |
23 | | contributors may be used to endorse or promote products |
24 | | derived from this software without specific prior |
25 | | written permission of the assimp team. |
26 | | |
27 | | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
28 | | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
29 | | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
30 | | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
31 | | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
32 | | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
33 | | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
34 | | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
35 | | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
36 | | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
37 | | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
38 | | |
39 | | ---------------------------------------------------------------------- |
40 | | */ |
41 | | |
42 | | /** @file LWOFileData.h |
43 | | * @brief Defines chunk constants used by the LWO file format |
44 | | |
45 | | The chunks are taken from the official LightWave SDK headers. |
46 | | |
47 | | */ |
48 | | #ifndef AI_LWO_FILEDATA_INCLUDED |
49 | | #define AI_LWO_FILEDATA_INCLUDED |
50 | | |
51 | | // STL headers |
52 | | #include <list> |
53 | | #include <vector> |
54 | | |
55 | | // public ASSIMP headers |
56 | | #include <assimp/mesh.h> |
57 | | |
58 | | // internal headers |
59 | | #include "AssetLib/LWO/LWOAnimation.h" |
60 | | #include "Common/IFF.h" |
61 | | |
62 | | namespace Assimp { |
63 | | namespace LWO { |
64 | | |
65 | 479 | #define AI_LWO_FOURCC_LWOB AI_IFF_FOURCC('L', 'W', 'O', 'B') |
66 | 479 | #define AI_LWO_FOURCC_LWO2 AI_IFF_FOURCC('L', 'W', 'O', '2') |
67 | 0 | #define AI_LWO_FOURCC_LWO3 AI_IFF_FOURCC('L', 'W', 'O', '3') |
68 | 479 | #define AI_LWO_FOURCC_LXOB AI_IFF_FOURCC('L', 'X', 'O', 'B') |
69 | | |
70 | | // chunks specific to the LWOB format |
71 | 0 | #define AI_LWO_SRFS AI_IFF_FOURCC('S', 'R', 'F', 'S') |
72 | | #define AI_LWO_FLAG AI_IFF_FOURCC('F', 'L', 'A', 'G') |
73 | | #define AI_LWO_VLUM AI_IFF_FOURCC('V', 'L', 'U', 'M') |
74 | | #define AI_LWO_VDIF AI_IFF_FOURCC('V', 'D', 'I', 'F') |
75 | | #define AI_LWO_VSPC AI_IFF_FOURCC('V', 'S', 'P', 'C') |
76 | | #define AI_LWO_RFLT AI_IFF_FOURCC('R', 'F', 'L', 'T') |
77 | 0 | #define AI_LWO_BTEX AI_IFF_FOURCC('B', 'T', 'E', 'X') |
78 | 0 | #define AI_LWO_CTEX AI_IFF_FOURCC('C', 'T', 'E', 'X') |
79 | 0 | #define AI_LWO_DTEX AI_IFF_FOURCC('D', 'T', 'E', 'X') |
80 | | #define AI_LWO_LTEX AI_IFF_FOURCC('L', 'T', 'E', 'X') |
81 | | #define AI_LWO_RTEX AI_IFF_FOURCC('R', 'T', 'E', 'X') |
82 | 0 | #define AI_LWO_STEX AI_IFF_FOURCC('S', 'T', 'E', 'X') |
83 | 0 | #define AI_LWO_TTEX AI_IFF_FOURCC('T', 'T', 'E', 'X') |
84 | 0 | #define AI_LWO_TFLG AI_IFF_FOURCC('T', 'F', 'L', 'G') |
85 | | #define AI_LWO_TSIZ AI_IFF_FOURCC('T', 'S', 'I', 'Z') |
86 | | #define AI_LWO_TCTR AI_IFF_FOURCC('T', 'C', 'T', 'R') |
87 | | #define AI_LWO_TFAL AI_IFF_FOURCC('T', 'F', 'A', 'L') |
88 | | #define AI_LWO_TVEL AI_IFF_FOURCC('T', 'V', 'E', 'L') |
89 | | #define AI_LWO_TCLR AI_IFF_FOURCC('T', 'C', 'L', 'R') |
90 | 0 | #define AI_LWO_TVAL AI_IFF_FOURCC('T', 'V', 'A', 'L') |
91 | | #define AI_LWO_TAMP AI_IFF_FOURCC('T', 'A', 'M', 'P') |
92 | | #define AI_LWO_TIMG AI_IFF_FOURCC('T', 'I', 'M', 'G') |
93 | | #define AI_LWO_TAAS AI_IFF_FOURCC('T', 'A', 'A', 'S') |
94 | | #define AI_LWO_TREF AI_IFF_FOURCC('T', 'R', 'E', 'F') |
95 | | #define AI_LWO_TOPC AI_IFF_FOURCC('T', 'O', 'P', 'C') |
96 | | #define AI_LWO_SDAT AI_IFF_FOURCC('S', 'D', 'A', 'T') |
97 | | #define AI_LWO_TFP0 AI_IFF_FOURCC('T', 'F', 'P', '0') |
98 | | #define AI_LWO_TFP1 AI_IFF_FOURCC('T', 'F', 'P', '1') |
99 | | |
100 | | /* top-level chunks */ |
101 | 0 | #define AI_LWO_LAYR AI_IFF_FOURCC('L', 'A', 'Y', 'R') |
102 | 0 | #define AI_LWO_TAGS AI_IFF_FOURCC('T', 'A', 'G', 'S') |
103 | 0 | #define AI_LWO_PNTS AI_IFF_FOURCC('P', 'N', 'T', 'S') |
104 | | #define AI_LWO_BBOX AI_IFF_FOURCC('B', 'B', 'O', 'X') |
105 | | #define AI_LWO_VMAP AI_IFF_FOURCC('V', 'M', 'A', 'P') |
106 | 0 | #define AI_LWO_VMAD AI_IFF_FOURCC('V', 'M', 'A', 'D') |
107 | 0 | #define AI_LWO_POLS AI_IFF_FOURCC('P', 'O', 'L', 'S') |
108 | 0 | #define AI_LWO_PTAG AI_IFF_FOURCC('P', 'T', 'A', 'G') |
109 | 0 | #define AI_LWO_ENVL AI_IFF_FOURCC('E', 'N', 'V', 'L') |
110 | 0 | #define AI_LWO_CLIP AI_IFF_FOURCC('C', 'L', 'I', 'P') |
111 | | #define AI_LWO_SURF AI_IFF_FOURCC('S', 'U', 'R', 'F') |
112 | | #define AI_LWO_DESC AI_IFF_FOURCC('D', 'E', 'S', 'C') |
113 | | #define AI_LWO_TEXT AI_IFF_FOURCC('T', 'E', 'X', 'T') |
114 | | #define AI_LWO_ICON AI_IFF_FOURCC('I', 'C', 'O', 'N') |
115 | | |
116 | | /* polygon types */ |
117 | 0 | #define AI_LWO_FACE AI_IFF_FOURCC('F', 'A', 'C', 'E') |
118 | 0 | #define AI_LWO_CURV AI_IFF_FOURCC('C', 'U', 'R', 'V') |
119 | 0 | #define AI_LWO_PTCH AI_IFF_FOURCC('P', 'T', 'C', 'H') |
120 | 0 | #define AI_LWO_MBAL AI_IFF_FOURCC('M', 'B', 'A', 'L') |
121 | 0 | #define AI_LWO_BONE AI_IFF_FOURCC('B', 'O', 'N', 'E') |
122 | 0 | #define AI_LWO_SUBD AI_IFF_FOURCC('S', 'U', 'B', 'D') |
123 | | |
124 | | /* polygon tags */ |
125 | 0 | #define AI_LWO_SURF AI_IFF_FOURCC('S', 'U', 'R', 'F') |
126 | | #define AI_LWO_PART AI_IFF_FOURCC('P', 'A', 'R', 'T') |
127 | 0 | #define AI_LWO_SMGP AI_IFF_FOURCC('S', 'M', 'G', 'P') |
128 | | |
129 | | /* envelopes */ |
130 | 0 | #define AI_LWO_PRE AI_IFF_FOURCC('P', 'R', 'E', ' ') |
131 | 0 | #define AI_LWO_POST AI_IFF_FOURCC('P', 'O', 'S', 'T') |
132 | 0 | #define AI_LWO_KEY AI_IFF_FOURCC('K', 'E', 'Y', ' ') |
133 | 0 | #define AI_LWO_SPAN AI_IFF_FOURCC('S', 'P', 'A', 'N') |
134 | 0 | #define AI_LWO_TCB AI_IFF_FOURCC('T', 'C', 'B', ' ') |
135 | 0 | #define AI_LWO_HERM AI_IFF_FOURCC('H', 'E', 'R', 'M') |
136 | 0 | #define AI_LWO_BEZI AI_IFF_FOURCC('B', 'E', 'Z', 'I') |
137 | 0 | #define AI_LWO_BEZ2 AI_IFF_FOURCC('B', 'E', 'Z', '2') |
138 | | #define AI_LWO_LINE AI_IFF_FOURCC('L', 'I', 'N', 'E') |
139 | 0 | #define AI_LWO_STEP AI_IFF_FOURCC('S', 'T', 'E', 'P') |
140 | | |
141 | | /* clips */ |
142 | 0 | #define AI_LWO_STIL AI_IFF_FOURCC('S', 'T', 'I', 'L') |
143 | 0 | #define AI_LWO_ISEQ AI_IFF_FOURCC('I', 'S', 'E', 'Q') |
144 | 0 | #define AI_LWO_ANIM AI_IFF_FOURCC('A', 'N', 'I', 'M') |
145 | 0 | #define AI_LWO_XREF AI_IFF_FOURCC('X', 'R', 'E', 'F') |
146 | 0 | #define AI_LWO_STCC AI_IFF_FOURCC('S', 'T', 'C', 'C') |
147 | | #define AI_LWO_TIME AI_IFF_FOURCC('T', 'I', 'M', 'E') |
148 | | #define AI_LWO_CONT AI_IFF_FOURCC('C', 'O', 'N', 'T') |
149 | | #define AI_LWO_BRIT AI_IFF_FOURCC('B', 'R', 'I', 'T') |
150 | | #define AI_LWO_SATR AI_IFF_FOURCC('S', 'A', 'T', 'R') |
151 | | #define AI_LWO_HUE AI_IFF_FOURCC('H', 'U', 'E', ' ') |
152 | | #define AI_LWO_GAMM AI_IFF_FOURCC('G', 'A', 'M', 'M') |
153 | 0 | #define AI_LWO_NEGA AI_IFF_FOURCC('N', 'E', 'G', 'A') |
154 | | #define AI_LWO_IFLT AI_IFF_FOURCC('I', 'F', 'L', 'T') |
155 | | #define AI_LWO_PFLT AI_IFF_FOURCC('P', 'F', 'L', 'T') |
156 | | |
157 | | /* surfaces */ |
158 | | #define AI_LWO_COLR AI_IFF_FOURCC('C', 'O', 'L', 'R') |
159 | 0 | #define AI_LWO_LUMI AI_IFF_FOURCC('L', 'U', 'M', 'I') |
160 | 0 | #define AI_LWO_DIFF AI_IFF_FOURCC('D', 'I', 'F', 'F') |
161 | 0 | #define AI_LWO_SPEC AI_IFF_FOURCC('S', 'P', 'E', 'C') |
162 | 0 | #define AI_LWO_GLOS AI_IFF_FOURCC('G', 'L', 'O', 'S') |
163 | 0 | #define AI_LWO_REFL AI_IFF_FOURCC('R', 'E', 'F', 'L') |
164 | | #define AI_LWO_RFOP AI_IFF_FOURCC('R', 'F', 'O', 'P') |
165 | | #define AI_LWO_RIMG AI_IFF_FOURCC('R', 'I', 'M', 'G') |
166 | | #define AI_LWO_RSAN AI_IFF_FOURCC('R', 'S', 'A', 'N') |
167 | 0 | #define AI_LWO_TRAN AI_IFF_FOURCC('T', 'R', 'A', 'N') |
168 | | #define AI_LWO_TROP AI_IFF_FOURCC('T', 'R', 'O', 'P') |
169 | 0 | #define AI_LWO_TIMG AI_IFF_FOURCC('T', 'I', 'M', 'G') |
170 | 0 | #define AI_LWO_RIND AI_IFF_FOURCC('R', 'I', 'N', 'D') |
171 | | #define AI_LWO_TRNL AI_IFF_FOURCC('T', 'R', 'N', 'L') |
172 | 0 | #define AI_LWO_BUMP AI_IFF_FOURCC('B', 'U', 'M', 'P') |
173 | 0 | #define AI_LWO_SMAN AI_IFF_FOURCC('S', 'M', 'A', 'N') |
174 | 0 | #define AI_LWO_SIDE AI_IFF_FOURCC('S', 'I', 'D', 'E') |
175 | 0 | #define AI_LWO_CLRH AI_IFF_FOURCC('C', 'L', 'R', 'H') |
176 | | #define AI_LWO_CLRF AI_IFF_FOURCC('C', 'L', 'R', 'F') |
177 | 0 | #define AI_LWO_ADTR AI_IFF_FOURCC('A', 'D', 'T', 'R') |
178 | | #define AI_LWO_SHRP AI_IFF_FOURCC('S', 'H', 'R', 'P') |
179 | 0 | #define AI_LWO_LINE AI_IFF_FOURCC('L', 'I', 'N', 'E') |
180 | | #define AI_LWO_LSIZ AI_IFF_FOURCC('L', 'S', 'I', 'Z') |
181 | | #define AI_LWO_ALPH AI_IFF_FOURCC('A', 'L', 'P', 'H') |
182 | | #define AI_LWO_AVAL AI_IFF_FOURCC('A', 'V', 'A', 'L') |
183 | | #define AI_LWO_GVAL AI_IFF_FOURCC('G', 'V', 'A', 'L') |
184 | 0 | #define AI_LWO_BLOK AI_IFF_FOURCC('B', 'L', 'O', 'K') |
185 | 0 | #define AI_LWO_VCOL AI_IFF_FOURCC('V', 'C', 'O', 'L') |
186 | | |
187 | | /* texture layer */ |
188 | 0 | #define AI_LWO_TYPE AI_IFF_FOURCC('T', 'Y', 'P', 'E') |
189 | 0 | #define AI_LWO_CHAN AI_IFF_FOURCC('C', 'H', 'A', 'N') |
190 | | #define AI_LWO_NAME AI_IFF_FOURCC('N', 'A', 'M', 'E') |
191 | 0 | #define AI_LWO_ENAB AI_IFF_FOURCC('E', 'N', 'A', 'B') |
192 | 0 | #define AI_LWO_OPAC AI_IFF_FOURCC('O', 'P', 'A', 'C') |
193 | | #define AI_LWO_FLAG AI_IFF_FOURCC('F', 'L', 'A', 'G') |
194 | 0 | #define AI_LWO_PROJ AI_IFF_FOURCC('P', 'R', 'O', 'J') |
195 | | #define AI_LWO_STCK AI_IFF_FOURCC('S', 'T', 'C', 'K') |
196 | | #define AI_LWO_TAMP AI_IFF_FOURCC('T', 'A', 'M', 'P') |
197 | | |
198 | | /* texture coordinates */ |
199 | | #define AI_LWO_TMAP AI_IFF_FOURCC('T', 'M', 'A', 'P') |
200 | 0 | #define AI_LWO_AXIS AI_IFF_FOURCC('A', 'X', 'I', 'S') |
201 | | #define AI_LWO_CNTR AI_IFF_FOURCC('C', 'N', 'T', 'R') |
202 | | #define AI_LWO_SIZE AI_IFF_FOURCC('S', 'I', 'Z', 'E') |
203 | | #define AI_LWO_ROTA AI_IFF_FOURCC('R', 'O', 'T', 'A') |
204 | | #define AI_LWO_OREF AI_IFF_FOURCC('O', 'R', 'E', 'F') |
205 | | #define AI_LWO_FALL AI_IFF_FOURCC('F', 'A', 'L', 'L') |
206 | | #define AI_LWO_CSYS AI_IFF_FOURCC('C', 'S', 'Y', 'S') |
207 | | |
208 | | /* image map */ |
209 | | #define AI_LWO_IMAP AI_IFF_FOURCC('I', 'M', 'A', 'P') |
210 | 0 | #define AI_LWO_IMAG AI_IFF_FOURCC('I', 'M', 'A', 'G') |
211 | 0 | #define AI_LWO_WRAP AI_IFF_FOURCC('W', 'R', 'A', 'P') |
212 | 0 | #define AI_LWO_WRPW AI_IFF_FOURCC('W', 'R', 'P', 'W') |
213 | 0 | #define AI_LWO_WRPH AI_IFF_FOURCC('W', 'R', 'P', 'H') |
214 | 0 | #define AI_LWO_VMAP AI_IFF_FOURCC('V', 'M', 'A', 'P') |
215 | | #define AI_LWO_AAST AI_IFF_FOURCC('A', 'A', 'S', 'T') |
216 | | #define AI_LWO_PIXB AI_IFF_FOURCC('P', 'I', 'X', 'B') |
217 | | |
218 | | /* procedural */ |
219 | 0 | #define AI_LWO_PROC AI_IFF_FOURCC('P', 'R', 'O', 'C') |
220 | 0 | #define AI_LWO_COLR AI_IFF_FOURCC('C', 'O', 'L', 'R') |
221 | | #define AI_LWO_VALU AI_IFF_FOURCC('V', 'A', 'L', 'U') |
222 | 0 | #define AI_LWO_FUNC AI_IFF_FOURCC('F', 'U', 'N', 'C') |
223 | | #define AI_LWO_FTPS AI_IFF_FOURCC('F', 'T', 'P', 'S') |
224 | | #define AI_LWO_ITPS AI_IFF_FOURCC('I', 'T', 'P', 'S') |
225 | | #define AI_LWO_ETPS AI_IFF_FOURCC('E', 'T', 'P', 'S') |
226 | | |
227 | | /* gradient */ |
228 | 0 | #define AI_LWO_GRAD AI_IFF_FOURCC('G', 'R', 'A', 'D') |
229 | | #define AI_LWO_GRST AI_IFF_FOURCC('G', 'R', 'S', 'T') |
230 | | #define AI_LWO_GREN AI_IFF_FOURCC('G', 'R', 'E', 'N') |
231 | | #define AI_LWO_PNAM AI_IFF_FOURCC('P', 'N', 'A', 'M') |
232 | | #define AI_LWO_INAM AI_IFF_FOURCC('I', 'N', 'A', 'M') |
233 | | #define AI_LWO_GRPT AI_IFF_FOURCC('G', 'R', 'P', 'T') |
234 | | #define AI_LWO_FKEY AI_IFF_FOURCC('F', 'K', 'E', 'Y') |
235 | | #define AI_LWO_IKEY AI_IFF_FOURCC('I', 'K', 'E', 'Y') |
236 | | |
237 | | /* shader */ |
238 | 0 | #define AI_LWO_SHDR AI_IFF_FOURCC('S', 'H', 'D', 'R') |
239 | | #define AI_LWO_DATA AI_IFF_FOURCC('D', 'A', 'T', 'A') |
240 | | |
241 | | /* VMAP types */ |
242 | 0 | #define AI_LWO_TXUV AI_IFF_FOURCC('T', 'X', 'U', 'V') |
243 | 0 | #define AI_LWO_RGB AI_IFF_FOURCC('R', 'G', 'B', ' ') |
244 | 0 | #define AI_LWO_RGBA AI_IFF_FOURCC('R', 'G', 'B', 'A') |
245 | 0 | #define AI_LWO_WGHT AI_IFF_FOURCC('W', 'G', 'H', 'T') |
246 | | |
247 | 0 | #define AI_LWO_MNVW AI_IFF_FOURCC('M', 'N', 'V', 'W') |
248 | 0 | #define AI_LWO_MORF AI_IFF_FOURCC('M', 'O', 'R', 'F') |
249 | 0 | #define AI_LWO_SPOT AI_IFF_FOURCC('S', 'P', 'O', 'T') |
250 | 0 | #define AI_LWO_PICK AI_IFF_FOURCC('P', 'I', 'C', 'K') |
251 | | |
252 | | // Surface Part |
253 | 0 | #define AI_LWO_NODS AI_IFF_FOURCC('N', 'O', 'D', 'S') |
254 | 0 | #define AI_LWO_NNDS AI_IFF_FOURCC('N', 'N', 'D', 'S') |
255 | 0 | #define AI_LWO_NTAG AI_IFF_FOURCC('N', 'T', 'A', 'G') |
256 | | #define AI_LWO_NRNM AI_IFF_FOURCC('N', 'R', 'N', 'M') |
257 | | #define AI_LWO_NRME AI_IFF_FOURCC('N', 'R', 'M', 'E') |
258 | 0 | #define AI_LWO_NDTA AI_IFF_FOURCC('N', 'D', 'T', 'A') |
259 | | #define AI_LWO_ATTR AI_IFF_FOURCC('A', 'T', 'T', 'R') |
260 | 0 | #define AI_LWO_VERS AI_IFF_FOURCC('V', 'E', 'R', 'S') |
261 | 0 | #define AI_LWO_ENUM AI_IFF_FOURCC('E', 'N', 'U', 'M') |
262 | 0 | #define AI_LWO_ENTR AI_IFF_FOURCC('E', 'N', 'T', 'R') |
263 | 0 | #define AI_LWO_NAME AI_IFF_FOURCC('N', 'A', 'M', 'E') |
264 | 0 | #define AI_LWO_FLAG AI_IFF_FOURCC('F', 'L', 'A', 'G') |
265 | 0 | #define AI_LWO_TAG AI_IFF_FOURCC('T', 'A', 'G', ' ') |
266 | 0 | #define AI_LWO_VALU AI_IFF_FOURCC('V', 'A', 'L', 'U') |
267 | 0 | #define AI_LWO_IBGC AI_IFF_FOURCC('I', 'B', 'G', 'C') |
268 | 0 | #define AI_LWO_IOPC AI_IFF_FOURCC('I', 'O', 'P', 'C') |
269 | 0 | #define AI_LWO_IIMG AI_IFF_FOURCC('I', 'I', 'M', 'G') |
270 | 0 | #define AI_LWO_TXTR AI_IFF_FOURCC('T', 'X', 'T', 'R') |
271 | | |
272 | 0 | #define AI_LWO_IFAL AI_IFF_FOURCC('I', 'F', 'A', 'L') |
273 | 0 | #define AI_LWO_ISCL AI_IFF_FOURCC('I', 'S', 'C', 'L') |
274 | 0 | #define AI_LWO_IPOS AI_IFF_FOURCC('I', 'P', 'O', 'S') |
275 | 0 | #define AI_LWO_IROT AI_IFF_FOURCC('I', 'R', 'O', 'T') |
276 | 0 | #define AI_LWO_IBMP AI_IFF_FOURCC('I', 'B', 'M', 'P') |
277 | 0 | #define AI_LWO_IUTD AI_IFF_FOURCC('I', 'U', 'T', 'D') |
278 | 0 | #define AI_LWO_IVTD AI_IFF_FOURCC('I', 'V', 'T', 'D') |
279 | | |
280 | 0 | #define AI_LWO_IPIX AI_IFF_FOURCC('I', 'P', 'I', 'X') |
281 | 0 | #define AI_LWO_IMIP AI_IFF_FOURCC('I', 'M', 'I', 'P') |
282 | 0 | #define AI_LWO_IMOD AI_IFF_FOURCC('I', 'M', 'O', 'D') |
283 | 0 | #define AI_LWO_AMOD AI_IFF_FOURCC('A', 'M', 'O', 'D') |
284 | 0 | #define AI_LWO_IINV AI_IFF_FOURCC('I', 'I', 'N', 'V') |
285 | 0 | #define AI_LWO_INCR AI_IFF_FOURCC('I', 'N', 'C', 'R') |
286 | 0 | #define AI_LWO_IAXS AI_IFF_FOURCC('I', 'A', 'X', 'S') |
287 | 0 | #define AI_LWO_IFOT AI_IFF_FOURCC('I', 'F', 'O', 'T') |
288 | 0 | #define AI_LWO_ITIM AI_IFF_FOURCC('I', 'T', 'I', 'M') |
289 | 0 | #define AI_LWO_IWRL AI_IFF_FOURCC('I', 'W', 'R', 'L') |
290 | 0 | #define AI_LWO_IUTI AI_IFF_FOURCC('I', 'U', 'T', 'I') |
291 | 0 | #define AI_LWO_IINX AI_IFF_FOURCC('I', 'I', 'N', 'X') |
292 | 0 | #define AI_LWO_IINY AI_IFF_FOURCC('I', 'I', 'N', 'Y') |
293 | 0 | #define AI_LWO_IINZ AI_IFF_FOURCC('I', 'I', 'N', 'Z') |
294 | 0 | #define AI_LWO_IREF AI_IFF_FOURCC('I', 'R', 'E', 'F') |
295 | 0 | #define AI_LWO_IMST AI_IFF_FOURCC('I', 'M', 'S', 'T') |
296 | 0 | #define AI_LWO_VPVL AI_IFF_FOURCC('V', 'P', 'V', 'L') |
297 | 0 | #define AI_LWO_VPRM AI_IFF_FOURCC('V', 'P', 'R', 'M') |
298 | 0 | #define AI_LWO_IMAP AI_IFF_FOURCC('I', 'M', 'A', 'P') |
299 | 0 | #define AI_LWO_IUVI AI_IFF_FOURCC('I', 'U', 'V', 'I') |
300 | 0 | #define AI_LWO_IUTL AI_IFF_FOURCC('I', 'U', 'T', 'L') |
301 | 0 | #define AI_LWO_IVTL AI_IFF_FOURCC('I', 'V', 'T', 'L') |
302 | | |
303 | | // MODO extension - per-vertex normal vectors |
304 | 0 | #define AI_LWO_MODO_NORM AI_IFF_FOURCC('N', 'O', 'R', 'M') |
305 | | |
306 | | // --------------------------------------------------------------------------- |
307 | | /** \brief Data structure for a face in a LWO file |
308 | | * |
309 | | * \note We can't use the code in SmoothingGroups.inl here - the mesh |
310 | | * structures of 3DS/ASE and LWO are too different. |
311 | | */ |
312 | | struct Face : public aiFace { |
313 | | //! Default construction |
314 | | Face() AI_NO_EXCEPT |
315 | 0 | : surfaceIndex(0), |
316 | 0 | smoothGroup(0), |
317 | 0 | type(AI_LWO_FACE) { |
318 | | // empty |
319 | 0 | } |
320 | | |
321 | | //! Construction from given type |
322 | | explicit Face(uint32_t _type) : |
323 | 0 | surfaceIndex(0), smoothGroup(0), type(_type) {} |
324 | | |
325 | | //! Copy construction |
326 | | Face(const Face &f) : |
327 | 0 | aiFace() { |
328 | 0 | *this = f; |
329 | 0 | } |
330 | | |
331 | | //! Zero-based index into tags chunk |
332 | | unsigned int surfaceIndex; |
333 | | |
334 | | //! Smooth group this face is assigned to |
335 | | unsigned int smoothGroup; |
336 | | |
337 | | //! Type of face |
338 | | uint32_t type; |
339 | | |
340 | | //! Assignment operator |
341 | 0 | Face &operator=(const LWO::Face &f) = default; |
342 | | }; |
343 | | |
344 | | // --------------------------------------------------------------------------- |
345 | | /** \brief Base structure for all vertex map representations |
346 | | */ |
347 | | struct VMapEntry { |
348 | | explicit VMapEntry(unsigned int _dims) : |
349 | 0 | dims(_dims) {} |
350 | | |
351 | 0 | virtual ~VMapEntry() = default; |
352 | | |
353 | | //! allocates memory for the vertex map |
354 | 0 | virtual void Allocate(unsigned int num) { |
355 | 0 | if (!rawData.empty()) |
356 | 0 | return; // return if already allocated |
357 | | |
358 | 0 | const unsigned int m = num * dims; |
359 | 0 | rawData.reserve(m + (m >> 2u)); // 25% as extra storage for VMADs |
360 | 0 | rawData.resize(m, 0.f); |
361 | 0 | abAssigned.resize(num, false); |
362 | 0 | } |
363 | | |
364 | | std::string name; |
365 | | unsigned int dims; |
366 | | |
367 | | std::vector<float> rawData; |
368 | | std::vector<bool> abAssigned; |
369 | | }; |
370 | | |
371 | | // --------------------------------------------------------------------------- |
372 | | /** \brief Represents an extra vertex color channel |
373 | | */ |
374 | | struct VColorChannel : public VMapEntry { |
375 | | VColorChannel() : |
376 | 0 | VMapEntry(4) {} |
377 | | |
378 | | //! need to overwrite this function - the alpha channel must |
379 | | //! be initialized to 1.0 by default |
380 | 0 | virtual void Allocate(unsigned int num) { |
381 | 0 | if (!rawData.empty()) |
382 | 0 | return; // return if already allocated |
383 | | |
384 | 0 | unsigned int m = num * dims; |
385 | 0 | rawData.reserve(m + (m >> 2u)); // 25% as extra storage for VMADs |
386 | 0 | rawData.resize(m); |
387 | |
|
388 | 0 | for (aiColor4D *p = (aiColor4D *)&rawData[0]; p < (aiColor4D *)&rawData[m - 1]; ++p) |
389 | 0 | p->a = 1.f; |
390 | |
|
391 | 0 | abAssigned.resize(num, false); |
392 | 0 | } |
393 | | }; |
394 | | |
395 | | // --------------------------------------------------------------------------- |
396 | | /** \brief Represents an extra vertex UV channel |
397 | | */ |
398 | | struct UVChannel : public VMapEntry { |
399 | | UVChannel() : |
400 | 0 | VMapEntry(2) {} |
401 | | }; |
402 | | |
403 | | // --------------------------------------------------------------------------- |
404 | | /** \brief Represents a weight map |
405 | | */ |
406 | | struct WeightChannel : public VMapEntry { |
407 | | WeightChannel() : |
408 | 0 | VMapEntry(1) {} |
409 | | }; |
410 | | |
411 | | // --------------------------------------------------------------------------- |
412 | | /** \brief Represents a vertex-normals channel (MODO extension) |
413 | | */ |
414 | | struct NormalChannel : public VMapEntry { |
415 | | NormalChannel() : |
416 | 0 | VMapEntry(3) {} |
417 | | }; |
418 | | |
419 | | // --------------------------------------------------------------------------- |
420 | | /** \brief Data structure for a LWO file texture |
421 | | */ |
422 | | struct Texture { |
423 | | // we write the enum values out here to make debugging easier ... |
424 | | enum BlendType { |
425 | | Normal = 0, |
426 | | Subtractive = 1, |
427 | | Difference = 2, |
428 | | Multiply = 3, |
429 | | Divide = 4, |
430 | | Alpha = 5, |
431 | | TextureDispl = 6, |
432 | | Additive = 7 |
433 | | }; |
434 | | |
435 | | enum MappingMode { |
436 | | Planar = 0, |
437 | | Cylindrical = 1, |
438 | | Spherical = 2, |
439 | | Cubic = 3, |
440 | | FrontProjection = 4, |
441 | | UV = 5 |
442 | | }; |
443 | | |
444 | | enum Axes { |
445 | | AXIS_X = 0, |
446 | | AXIS_Y = 1, |
447 | | AXIS_Z = 2 |
448 | | }; |
449 | | |
450 | | enum Wrap { |
451 | | RESET = 0, |
452 | | REPEAT = 1, |
453 | | MIRROR = 2, |
454 | | EDGE = 3 |
455 | | }; |
456 | | |
457 | | Texture() : |
458 | 0 | mClipIdx(UINT_MAX), mStrength(1.0f), type(), mUVChannelIndex("unknown"), mRealUVIndex(UINT_MAX), enabled(true), blendType(Additive), bCanUse(true), mapMode(UV), majorAxis(AXIS_X), wrapAmountH(1.0f), wrapAmountW(1.0f), wrapModeWidth(REPEAT), wrapModeHeight(REPEAT), ordinal("\x00") {} |
459 | | |
460 | | //! File name of the texture |
461 | | std::string mFileName; |
462 | | |
463 | | //! Clip index |
464 | | unsigned int mClipIdx; |
465 | | |
466 | | //! Strength of the texture - blend factor |
467 | | float mStrength; |
468 | | |
469 | | uint32_t type; // type of the texture |
470 | | |
471 | | //! Name of the corresponding UV channel |
472 | | std::string mUVChannelIndex; |
473 | | unsigned int mRealUVIndex; |
474 | | |
475 | | //! is the texture enabled? |
476 | | bool enabled; |
477 | | |
478 | | //! blend type |
479 | | BlendType blendType; |
480 | | |
481 | | //! are we able to use the texture? |
482 | | bool bCanUse; |
483 | | |
484 | | //! mapping mode |
485 | | MappingMode mapMode; |
486 | | |
487 | | //! major axis for planar, cylindrical, spherical projections |
488 | | Axes majorAxis; |
489 | | |
490 | | //! wrap amount for cylindrical and spherical projections |
491 | | float wrapAmountH, wrapAmountW; |
492 | | |
493 | | //! wrapping mode for the texture |
494 | | Wrap wrapModeWidth, wrapModeHeight; |
495 | | |
496 | | //! ordinal string of the texture |
497 | | std::string ordinal; |
498 | | }; |
499 | | |
500 | | // --------------------------------------------------------------------------- |
501 | | /** \brief Data structure for a LWO file clip |
502 | | */ |
503 | | struct Clip { |
504 | | enum Type { |
505 | | STILL, |
506 | | SEQ, |
507 | | REF, |
508 | | UNSUPPORTED |
509 | | } type; |
510 | | |
511 | | Clip() : |
512 | 0 | type(UNSUPPORTED), clipRef(), idx(0), negate(false) {} |
513 | | |
514 | | //! path to the base texture - |
515 | | std::string path; |
516 | | |
517 | | //! reference to another CLIP |
518 | | unsigned int clipRef; |
519 | | |
520 | | //! index of the clip |
521 | | unsigned int idx; |
522 | | |
523 | | //! Negate the clip? |
524 | | bool negate; |
525 | | }; |
526 | | |
527 | | // --------------------------------------------------------------------------- |
528 | | /** \brief Data structure for a LWO file shader |
529 | | * |
530 | | * Later |
531 | | */ |
532 | | struct Shader { |
533 | | Shader() : |
534 | 0 | ordinal("\x00"), functionName("unknown"), enabled(true) {} |
535 | | |
536 | | std::string ordinal; |
537 | | std::string functionName; |
538 | | bool enabled; |
539 | | }; |
540 | | |
541 | | typedef std::list<Texture> TextureList; |
542 | | typedef std::list<Shader> ShaderList; |
543 | | |
544 | | // --------------------------------------------------------------------------- |
545 | | /** \brief Data structure for a LWO file surface (= material) |
546 | | */ |
547 | | struct Surface { |
548 | | Surface() : |
549 | 0 | mColor(0.78431f, 0.78431f, 0.78431f), bDoubleSided(false), mDiffuseValue(1.f), mSpecularValue(0.f), mTransparency(0.f), mGlossiness(0.4f), mLuminosity(0.f), mColorHighlights(0.f), mMaximumSmoothAngle(0.f) // 0 == not specified, no smoothing |
550 | | , |
551 | 0 | mVCMap(), |
552 | | mVCMapType(AI_LWO_RGBA), |
553 | 0 | mIOR(1.f) // vakuum |
554 | | , |
555 | 0 | mBumpIntensity(1.f), |
556 | 0 | mWireframe(false), |
557 | 0 | mAdditiveTransparency(0.f) {} |
558 | | |
559 | | //! Name of the surface |
560 | | std::string mName; |
561 | | |
562 | | //! Color of the surface |
563 | | aiColor3D mColor; |
564 | | |
565 | | //! true for two-sided materials |
566 | | bool bDoubleSided; |
567 | | |
568 | | //! Various material parameters |
569 | | float mDiffuseValue, mSpecularValue, mTransparency, mGlossiness, mLuminosity, mColorHighlights; |
570 | | |
571 | | //! Maximum angle between two adjacent triangles |
572 | | //! that they can be smoothed - in degrees |
573 | | float mMaximumSmoothAngle; |
574 | | |
575 | | //! Vertex color map to be used to color the surface |
576 | | std::string mVCMap; |
577 | | uint32_t mVCMapType; |
578 | | |
579 | | //! Names of the special shaders to be applied to the surface |
580 | | ShaderList mShaders; |
581 | | |
582 | | //! Textures - the first entry in the list is evaluated first |
583 | | TextureList mColorTextures, // color textures are added to both diffuse and specular texture stacks |
584 | | mDiffuseTextures, |
585 | | mSpecularTextures, |
586 | | mOpacityTextures, |
587 | | mBumpTextures, |
588 | | mGlossinessTextures, |
589 | | mReflectionTextures; |
590 | | |
591 | | //! Index of refraction |
592 | | float mIOR; |
593 | | |
594 | | //! Bump intensity scaling |
595 | | float mBumpIntensity; |
596 | | |
597 | | //! Wireframe flag |
598 | | bool mWireframe; |
599 | | |
600 | | //! Intensity of additive blending |
601 | | float mAdditiveTransparency; |
602 | | }; |
603 | | |
604 | | // --------------------------------------------------------------------------- |
605 | | /** \brief Data structure for a LWO node |
606 | | */ |
607 | | struct Node { |
608 | | // Name of node |
609 | | std::string mName; |
610 | | |
611 | | // RefName of node |
612 | | std::string mRefName; |
613 | | |
614 | | // Ref FileName |
615 | | std::string fileName; |
616 | | }; |
617 | | |
618 | | struct NodeAttribute { |
619 | | //! Color of the surface |
620 | | aiColor3D mColor; |
621 | | |
622 | | //! true for two-sided materials |
623 | | bool bDoubleSided; |
624 | | |
625 | | //! Various material parameters |
626 | | float mDiffuseValue, mSpecularValue, mTransparency, mGlossiness, mLuminosity, mColorHighlights; |
627 | | }; |
628 | | |
629 | | // --------------------------------------------------------------------------- |
630 | | #define AI_LWO_VALIDATE_CHUNK_LENGTH(length, name, size) \ |
631 | 0 | if (length < size) { \ |
632 | 0 | throw DeadlyImportError("LWO: " #name " chunk is too small"); \ |
633 | 0 | } |
634 | | |
635 | | // some typedefs ... to make life with loader monsters like this easier |
636 | | typedef std::vector<aiVector3D> PointList; |
637 | | typedef std::vector<LWO::Face> FaceList; |
638 | | typedef std::vector<LWO::Surface> SurfaceList; |
639 | | typedef std::vector<std::string> TagList; |
640 | | typedef std::vector<unsigned int> TagMappingTable; |
641 | | typedef std::vector<unsigned int> ReferrerList; |
642 | | typedef std::vector<WeightChannel> WeightChannelList; |
643 | | typedef std::vector<VColorChannel> VColorChannelList; |
644 | | typedef std::vector<UVChannel> UVChannelList; |
645 | | typedef std::vector<Clip> ClipList; |
646 | | typedef std::vector<Envelope> EnvelopeList; |
647 | | typedef std::vector<unsigned int> SortedRep; |
648 | | |
649 | | // --------------------------------------------------------------------------- |
650 | | /** \brief Represents a layer in the file |
651 | | */ |
652 | | struct Layer { |
653 | | Layer() : |
654 | 0 | mFaceIDXOfs(0), mPointIDXOfs(0), mParent(0x0), mIndex(0xffff), skip(false) {} |
655 | | |
656 | | /** Temporary point list from the file */ |
657 | | PointList mTempPoints; |
658 | | |
659 | | /** Lists for every point the index of another point |
660 | | that has been copied from *this* point or UINT_MAX if |
661 | | no copy of the point has been made */ |
662 | | ReferrerList mPointReferrers; |
663 | | |
664 | | /** Weight channel list from the file */ |
665 | | WeightChannelList mWeightChannels; |
666 | | |
667 | | /** Subdivision weight channel list from the file */ |
668 | | WeightChannelList mSWeightChannels; |
669 | | |
670 | | /** Vertex color list from the file */ |
671 | | VColorChannelList mVColorChannels; |
672 | | |
673 | | /** UV channel list from the file */ |
674 | | UVChannelList mUVChannels; |
675 | | |
676 | | /** Normal vector channel from the file */ |
677 | | NormalChannel mNormals; |
678 | | |
679 | | /** Temporary face list from the file*/ |
680 | | FaceList mFaces; |
681 | | |
682 | | /** Current face indexing offset from the beginning of the buffers*/ |
683 | | unsigned int mFaceIDXOfs; |
684 | | |
685 | | /** Current point indexing offset from the beginning of the buffers*/ |
686 | | unsigned int mPointIDXOfs; |
687 | | |
688 | | /** Parent index */ |
689 | | uint16_t mParent; |
690 | | |
691 | | /** Index of the layer */ |
692 | | uint16_t mIndex; |
693 | | |
694 | | /** Name of the layer */ |
695 | | std::string mName; |
696 | | |
697 | | /** Pivot point of the layer */ |
698 | | aiVector3D mPivot; |
699 | | |
700 | | /** Skip this layer? */ |
701 | | bool skip; |
702 | | }; |
703 | | |
704 | | typedef std::list<LWO::Layer> LayerList; |
705 | | |
706 | | } // namespace LWO |
707 | | } // namespace Assimp |
708 | | |
709 | | #endif // !! AI_LWO_FILEDATA_INCLUDED |