• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

PredatorCZ / RevilLib / 147

13 May 2024 09:43PM UTC coverage: 11.246% (-0.3%) from 11.534%
147

push

github

PredatorCZ
add lmt v68 support

757 of 6731 relevant lines covered (11.25%)

6713.75 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.7
/src/mtf_mod/common.cpp
1
/*  Revil Format Library
2
    Copyright(C) 2017-2021 Lukas Cone
3

4
    This program is free software : you can redistribute it and / or modify
5
    it under the terms of the GNU General Public License as published by
6
    the Free Software Foundation, either version 3 of the License, or
7
    (at your option) any later version.
8

9
    This program is distributed in the hope that it will be useful,
10
    but WITHOUT ANY WARRANTY; without even the implied warranty of
11
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
12
    GNU General Public License for more details.
13

14
    You should have received a copy of the GNU General Public License
15
    along with this program.If not, see <https://www.gnu.org/licenses/>.
16
*/
17

18
#include "traits.hpp"
19
#include <set>
20

21
using namespace revil;
22

23
struct AttributeAdd : AttributeCodec {
×
24
  void Sample(uni::FormatCodec::fvec &, const char *, size_t) const override {}
×
25
  void Transform(uni::FormatCodec::fvec &in) const override {
×
26
    for (Vector4A16 &v : in) {
×
27
      v += add;
×
28
    }
29
  }
30
  bool CanSample() const override { return false; }
×
31
  bool CanTransform() const override { return true; }
×
32
  bool IsNormalized() const override { return false; }
×
33

34
  uint32 add;
35
} ATTRADDCDX;
36

37
using F = uni::FormatType;
38
using D = uni::DataType;
39
using U = AttributeType;
40
using V = Attribute;
41

42
static AttributeUnormToSnorm NORMALCDX;
43

44
static const Attribute VertexNormal{D::R8G8B8A8, F::UNORM, U::Normal, -1,
45
                                    &NORMALCDX};
46
static const Attribute VertexNormal3{D::R8G8B8, F::UNORM, U::Normal, -1,
47
                                     &NORMALCDX};
48
static const Attribute VertexTangent{D::R8G8B8A8, F::UNORM, U::Tangent, -1,
49
                                     &NORMALCDX};
50
static const Attribute VertexTangent3{D::R8G8B8, F::UNORM, U::Tangent, -1,
51
                                      &NORMALCDX};
52

53
struct AttributeTexCoordPhone : AttributeCodec {
54
  void Sample(uni::FormatCodec::fvec &, const char *, size_t) const override {}
×
55
  void Transform(uni::FormatCodec::fvec &in) const override {
×
56
    for (Vector4A16 &v : in) {
×
57
      v *= 64;
58
    }
59
  }
60
  bool CanSample() const override { return false; }
×
61
  bool CanTransform() const override { return true; }
×
62
  bool IsNormalized() const override { return false; }
×
63
} TXCRDPHONECDX;
64

65
static const Attribute TexCoordPhone{D::R16G16, F::UNORM, U::TextureCoordiante,
66
                                     -1, &TXCRDPHONECDX};
67

68
Attribute Packed(Attribute in) {
×
69
  in.offset = 1;
70
  return in;
×
71
}
72

73
static const Attribute TexCoord{D::R16G16, F::FLOAT, U::TextureCoordiante};
74

75
static const Attribute VertexQPosition{D::R16G16B16, F::NORM, U::Position};
76

77
static const Attribute VertexPosition{D::R32G32B32, F::FLOAT, U::Position};
78

79
static const Attribute VertexBoneIndices{D::R8G8B8A8, F::UINT, U::BoneIndices};
80

81
static const Attribute VertexColor{D::R8G8B8A8, F::UNORM, U::VertexColor};
82

83
static const Attribute VertexNormalSigned{D::R8G8B8A8, F::NORM, U::Normal};
84

85
static const Attribute VertexTangentSigned{D::R8G8B8A8, F::NORM, U::Tangent};
86

87
static constexpr uint32 fmtStrides[]{0,  128, 96, 64, 64, 48, 32, 32, 32,
88
                                     32, 32,  32, 24, 16, 16, 16, 16, 8};
89

90
static const auto swapBuffers = [](MODVertexSpan &spn) {
91
  const size_t numVertices = spn.numVertices;
×
92
  uint32 stride = spn.stride;
×
93
  uint32 curOffset = 0;
94

95
  for (auto &d : spn.attrs) {
×
96
    char *curBuffer = spn.buffer + curOffset;
×
97
    curOffset += fmtStrides[uint32(d.type)] / 8;
×
98

99
    switch (d.type) {
×
100
    case uni::DataType::R16: {
101
      for (size_t v = 0; v < numVertices; v++, curBuffer += stride) {
×
102
        FByteswapper(*reinterpret_cast<uint16 *>(curBuffer));
103
      }
104
      break;
105
    }
106

107
    case uni::DataType::R16G16: {
108
      for (size_t v = 0; v < numVertices; v++, curBuffer += stride) {
×
109
        FByteswapper(*reinterpret_cast<USVector2 *>(curBuffer));
110
      }
111
      break;
112
    }
113

114
    case uni::DataType::R16G16B16: {
115
      for (size_t v = 0; v < numVertices; v++, curBuffer += stride) {
×
116
        FByteswapper(*reinterpret_cast<USVector *>(curBuffer));
117
      }
118
      break;
119
    }
120

121
    case uni::DataType::R16G16B16A16: {
122
      for (size_t v = 0; v < numVertices; v++, curBuffer += stride) {
×
123
        FByteswapper(*reinterpret_cast<USVector4 *>(curBuffer));
124
      }
125
      break;
126
    }
127

128
    case uni::DataType::R32:
129
    case uni::DataType::R10G10B10A2: {
130
      for (size_t v = 0; v < numVertices; v++, curBuffer += stride) {
×
131
        FByteswapper(*reinterpret_cast<uint32 *>(curBuffer));
×
132
      }
133
      break;
134
    }
135

136
    case uni::DataType::R8G8B8A8:
×
137
      if (d.offset == 1) {
×
138
        for (size_t v = 0; v < numVertices; v++, curBuffer += stride) {
×
139
          FByteswapper(*reinterpret_cast<uint32 *>(curBuffer));
×
140
        }
141
      }
142
      break;
143

144
    case uni::DataType::R32G32: {
145
      for (size_t v = 0; v < numVertices; v++, curBuffer += stride) {
×
146
        FByteswapper(*reinterpret_cast<Vector2 *>(curBuffer));
147
      }
148
      break;
149
    }
150

151
    case uni::DataType::R32G32B32: {
152
      for (size_t v = 0; v < numVertices; v++, curBuffer += stride) {
×
153
        FByteswapper(*reinterpret_cast<Vector *>(curBuffer));
154
      }
155
      break;
156
    }
157

158
    default:
159
      break;
160
    }
161
  }
162
};
163

164
static const auto makeVertices0X70 = [](uint8 useSkin, bool v1stride4,
165
                                        auto &main) {
166
  std::vector<Attribute> attrs;
×
167
  std::vector<std::unique_ptr<AttributeCodec>> codecs;
×
168
  const bool skin8 = useSkin == 2;
169

170
  if (useSkin) {
×
171
    auto mcdx = std::make_unique<AttributeMad>();
×
172
    mcdx->mul = main.bounds.bboxMax - main.bounds.bboxMin;
173
    mcdx->add = main.bounds.bboxMin;
×
174
    attrs.emplace_back(
×
175
        Attribute{D::R16G16B16A16, F::UNORM, U::Position, -1, mcdx.get()});
176
    codecs.emplace_back(std::move(mcdx));
×
177

178
    if (skin8) {
×
179
      attrs.emplace_back(VertexBoneIndices);
×
180
      attrs.emplace_back(VertexBoneIndices);
×
181
      attrs.emplace_back(D::R8G8B8A8, F::UNORM, U::BoneWeights);
×
182
      attrs.emplace_back(D::R8G8B8A8, F::UNORM, U::BoneWeights);
×
183
      attrs.emplace_back(D::R10G10B10A2, F::NORM, U::Normal);
×
184
      attrs.emplace_back(TexCoord);
×
185
    } else {
186
      attrs.emplace_back(VertexBoneIndices);
×
187
      attrs.emplace_back(D::R8G8B8A8, F::UNORM, U::BoneWeights);
×
188
      attrs.emplace_back(D::R10G10B10A2, F::NORM, U::Normal);
×
189
      attrs.emplace_back(D::R10G10B10A2, F::NORM, U::Undefined); // tangent
×
190
      attrs.emplace_back(TexCoord);
×
191
    }
192
  } else {
193
    attrs.emplace_back(VertexPosition);
×
194
    attrs.emplace_back(Packed(VertexNormalSigned));
×
195

196
    if (v1stride4) {
×
197
      // attrs.emplace_back(Packed(VertexTangentSigned)); // tangent
198
      attrs.emplace_back(D::R32, F::UINT, U::Undefined);
×
199
      attrs.emplace_back(TexCoord);
×
200
      attrs.emplace_back(TexCoord);
×
201
      // null or swapped with tangent
202
      attrs.emplace_back(D::R32, F::UINT, U::Undefined);
×
203
    } else {
204
      // always null?
205
      attrs.emplace_back(D::R32, F::UINT, U::Undefined);
×
206
      attrs.emplace_back(TexCoord);
×
207
      attrs.emplace_back(TexCoord);
×
208
      // attrs.emplace_back(Packed(VertexTangentSigned));
209
      attrs.emplace_back(D::R32, F::UINT, U::Undefined);
×
210
    }
211
  }
212

213
  return std::make_pair(attrs, std::move(codecs));
×
214
};
215

216
static const auto makeVertices1X70 = [](uint8 useSkin, bool v1stride4) {
217
  std::vector<Attribute> attrs;
×
218
  const bool skin8 = useSkin == 2;
219

220
  if (skin8) {
×
221
    // attrs.emplace_back(D::R10G10B10A2, F::NORM, U::Tangent);
222
    attrs.emplace_back(D::R32, F::UINT, U::Undefined);
×
223
    attrs.emplace_back(TexCoord);
×
224
  } else {
225
    attrs.emplace_back(VertexColor);
×
226

227
    if (!v1stride4) {
×
228
      attrs.emplace_back(VertexColor);
×
229
    }
230
  }
231
  return attrs;
×
232
};
233

234
static const auto makeVertices0X99 = [](uint8 useSkin, bool v1stride4,
235
                                        auto &main) {
236
  std::vector<Attribute> attrs;
×
237
  std::vector<std::unique_ptr<AttributeCodec>> codecs;
×
238
  const bool skin8 = useSkin == 4;
239

240
  if (useSkin) {
×
241
    auto mcdx = std::make_unique<AttributeMad>();
×
242
    mcdx->mul = main.bounds.bboxMax - main.bounds.bboxMin;
243
    mcdx->add = main.bounds.bboxMin;
×
244
    attrs.emplace_back(
×
245
        Attribute{D::R16G16B16A16, F::NORM, U::Position, -1, mcdx.get()});
246
    codecs.emplace_back(std::move(mcdx));
×
247

248
    if (skin8) {
×
249
      attrs.emplace_back(VertexBoneIndices);
×
250
      attrs.emplace_back(VertexBoneIndices);
×
251
      attrs.emplace_back(D::R8G8B8A8, F::UNORM, U::BoneWeights);
×
252
      attrs.emplace_back(D::R8G8B8A8, F::UNORM, U::BoneWeights);
×
253
      attrs.emplace_back(VertexNormal);
×
254
      attrs.emplace_back(TexCoord);
×
255
    } else {
256
      attrs.emplace_back(VertexBoneIndices);
×
257
      attrs.emplace_back(D::R8G8B8A8, F::UNORM, U::BoneWeights);
×
258
      attrs.emplace_back(VertexNormal);
×
259
      // attrs.emplace_back(VertexTangent);
260
      attrs.emplace_back(D::R32, F::UINT, U::Undefined);
×
261
      attrs.emplace_back(TexCoord);
×
262
    }
263
  } else {
264
    attrs.emplace_back(VertexPosition);
×
265
    attrs.emplace_back(VertexNormal);
×
266

267
    if (v1stride4) {
×
268
      // attrs.emplace_back(VertexTangent);
269
      attrs.emplace_back(D::R32, F::UINT, U::Undefined);
×
270
      attrs.emplace_back(TexCoord);
×
271
      attrs.emplace_back(TexCoord);
×
272
      // null or swapped with tangent
273
      attrs.emplace_back(D::R32, F::UINT, U::Undefined);
×
274
    } else {
275
      // always null?
276
      attrs.emplace_back(D::R32, F::UINT, U::Undefined);
×
277
      attrs.emplace_back(TexCoord);
×
278
      attrs.emplace_back(TexCoord);
×
279
      // attrs.emplace_back(VertexTangent);
280
      attrs.emplace_back(D::R32, F::UINT, U::Undefined);
×
281
    }
282
  }
283

284
  return std::make_pair(attrs, std::move(codecs));
×
285
};
286

287
static const auto makeVertices1X99 = [](uint8 useSkin, bool v1stride4) {
288
  std::vector<Attribute> attrs;
×
289
  const bool skin8 = useSkin == 4;
×
290

291
  if (skin8) {
292
    // attrs.emplace_back(VertexTangent);
×
293
    attrs.emplace_back(D::R32, F::UINT, U::Undefined);
×
294
    attrs.emplace_back(TexCoord);
295
  } else {
×
296
    attrs.emplace_back(VertexColor);
×
297

298
    if (!v1stride4) {
×
299
      attrs.emplace_back(VertexColor);
300
    }
×
301
  }
×
302
  return attrs;
×
303
};
×
304

×
305
static const auto makeVertices0X170 = [](uint8 useSkin, bool, auto &main) {
×
306
  std::vector<Attribute> attrs;
×
307
  std::vector<std::unique_ptr<AttributeCodec>> codecs;
308
  const bool skin8 = useSkin == 2;
×
309

×
310
  if (useSkin) {
×
311
    auto mcdx = std::make_unique<AttributeMad>();
312
    mcdx->mul = main.bounds.bboxMax - main.bounds.bboxMin;
×
313
    mcdx->add = main.bounds.bboxMin;
×
314
    attrs.emplace_back(
315
        Attribute{D::R16G16B16A16, F::NORM, U::Position, -1, mcdx.get()});
316
    codecs.emplace_back(std::move(mcdx));
×
317

×
318
    if (skin8) {
319
      attrs.emplace_back(VertexBoneIndices);
×
320
      attrs.emplace_back(VertexBoneIndices);
321
      attrs.emplace_back(D::R8G8B8A8, F::UNORM, U::BoneWeights);
×
322
      attrs.emplace_back(D::R8G8B8A8, F::UNORM, U::BoneWeights);
×
323
      attrs.emplace_back(VertexNormal);
×
324
      attrs.emplace_back(TexCoord);
325
    } else {
×
326
      attrs.emplace_back(VertexBoneIndices);
327
      attrs.emplace_back(D::R8G8B8A8, F::UNORM, U::BoneWeights);
328
      attrs.emplace_back(D::R16G16B16A16, F::NORM, U::Normal);
×
329
      attrs.emplace_back(TexCoord);
×
330
    }
×
331
  } else {
332
    attrs.emplace_back(VertexPosition);
×
333
    attrs.emplace_back(D::R16G16B16A16, F::NORM, U::Normal);
334
    attrs.emplace_back(D::R32G32, F::FLOAT, U::TextureCoordiante);
335
  }
336

×
337
  return std::make_pair(attrs, std::move(codecs));
338
};
339

340
static const auto makeVertices1X170 = [](uint8 useSkin, bool) {
×
341
  std::vector<Attribute> attrs;
×
342
  const bool skin8 = useSkin == 2;
343

344
  if (useSkin) {
×
345
    // attrs.emplace_back(D::R16G16B16A16, F::NORM, U::Tangent);
×
346
    attrs.emplace_back(D::R32G32, F::UINT, U::Undefined);
347
    attrs.emplace_back(TexCoord);
×
348
  } else if (skin8) {
×
349
    // attrs.emplace_back(VertexTangent);
350
    attrs.emplace_back(D::R32, F::UINT, U::Undefined);
×
351
    attrs.emplace_back(TexCoord);
352
  } else {
×
353
    // attrs.emplace_back(D::R16G16B16A16, F::NORM, U::Tangent);
×
354
    attrs.emplace_back(D::R32G32, F::UINT, U::Undefined);
×
355
    attrs.emplace_back(D::R32G32, F::FLOAT, U::TextureCoordiante);
×
356
    attrs.emplace_back(VertexColor);
×
357
    attrs.emplace_back(VertexColor);
×
358
    attrs.emplace_back(VertexColor);
×
359
  }
360
  return attrs;
×
361
};
×
362

×
363
static const auto makeV1 = [](auto &self, auto &main, auto v0Maker,
364
                              auto v1Maker, auto &&fd) {
×
365
  auto &mat = main.materials[self.materialIndex].main;
×
366
  using material_type = typename std::remove_reference<decltype(mat)>::type;
367
  auto skinType = mat.vshData.template Get<typename material_type::SkinType>();
368

×
369
  revil::MODPrimitive retval;
×
370
  retval.lod1 = self.visibleLOD[0];
371
  retval.lod2 = self.visibleLOD[1];
×
372
  retval.lod3 = self.visibleLOD[2];
373
  retval.materialIndex = self.materialIndex;
×
374
  retval.triStrips = true;
×
375
  retval.groupId = self.unk;
×
376
  retval.meshId = 0;
377
  retval.vertexIndex = main.vertices.size();
×
378

379
  MODVertexSpan vtx;
380
  std::tie(vtx.attrs, vtx.codecs) =
×
381
      v0Maker(skinType, self.buffer1Stride != 8, main);
×
382
  vtx.numVertices = self.numVertices;
×
383
  vtx.buffer =
384
      main.vertexBuffer.data() + (self.vertexStart * self.buffer0Stride) +
×
385
      self.vertexStreamOffset + (self.indexValueOffset * self.buffer0Stride);
386
  vtx.stride = self.buffer0Stride;
387
  fd(vtx);
388
  for (auto &a : vtx.attrs) {
×
389
    a.offset = -1;
390
  }
391

392
  main.vertices.emplace_back(std::move(vtx));
×
393

394
  /*if (skin8 && self.buffer1Stride != 8) {
395
    throw std::runtime_error("Expected secondary buffer of 8 bytes!");
×
396
  }
397

×
398
  if (!skin8 && skinType && self.buffer1Stride) {
×
399
    throw std::runtime_error("Unexpected secondary buffer for skin!");
400
  }*/
×
401

402
  if (self.buffer1Stride) {
×
403
    MODVertexSpan vtx1;
×
404
    vtx1.attrs = v1Maker(skinType, self.buffer1Stride != 8);
405
    vtx1.numVertices = self.numVertices;
406
    vtx1.buffer = &main.vertexBuffer.back() - main.unkBufferSize + 1;
×
407
    vtx1.buffer += (self.vertexStart * self.buffer1Stride) +
408
                   self.vertexStream2Offset +
409
                   (self.indexValueOffset * self.buffer1Stride);
410
    vtx1.stride = self.buffer1Stride;
×
411
    fd(vtx1);
×
412
    for (auto &a : vtx1.attrs) {
413
      a.offset = -1;
414
    }
×
415

×
416
    main.vertices.emplace_back(std::move(vtx1));
417
  }
×
418

×
419
  uint16 *indexBuffer = main.indexBuffer.data() + self.indexStart;
420
  retval.indexIndex = main.indices.size();
×
421

422
  MODIndexSpan idArray(indexBuffer, self.numIndices);
×
423

×
424
  for (auto &idx : idArray) {
×
425
    if (idx != 0xffff) {
×
426
      idx -= self.vertexStart;
×
427
    }
×
428
  }
×
429

430
  main.indices.emplace_back(idArray);
×
431

×
432
  return retval;
×
433
};
×
434

435
revil::MODPrimitive MODMeshX70::ReflectLE(revil::MODImpl &main_) {
436
  auto &main = static_cast<MODInner<MODTraitsX170> &>(main_);
×
437
  return makeV1(*this, main, makeVertices0X170, makeVertices1X170,
×
438
                [&](MODVertexSpan &) {});
×
439
}
440

441
revil::MODPrimitive MODMeshX70::ReflectBE(revil::MODImpl &main_) {
×
442
  auto &main = static_cast<MODInner<MODTraitsX70> &>(main_);
443
  return makeV1(*this, main, makeVertices0X70, makeVertices1X70,
444
                [&](MODVertexSpan &d) { swapBuffers(d); });
445
}
×
446

447
revil::MODPrimitive MODMeshX99::ReflectLE(revil::MODImpl &main_) {
448
  auto &main = static_cast<MODInner<MODTraitsX99LE> &>(main_);
×
449
  auto retval = makeV1(*this, main, makeVertices0X99, makeVertices1X99,
450
                       [&](MODVertexSpan &) {});
×
451
  retval.skinIndex = skinInfo.boneRemapIndex;
×
452
  return retval;
453
}
454

455
revil::MODPrimitive MODMeshX99::ReflectBE(revil::MODImpl &main_) {
456
  auto &main = static_cast<MODInner<MODTraitsX99BE> &>(main_);
457
  auto retval = makeV1(*this, main, makeVertices0X99, makeVertices1X99,
458
                       [&](MODVertexSpan &d) { swapBuffers(d); });
×
459
  retval.skinIndex = skinInfo.boneRemapIndex;
×
460
  return retval;
×
461
}
×
462

×
463
struct MODAttributes {
464
  std::vector<Attribute> attrs;
×
465
  uint32 stride = 0;
466

467
  MODAttributes(std::initializer_list<Attribute> attrs_) : attrs(attrs_) {
468
    for (auto &d : attrs) {
469
      stride += fmtStrides[uint32(d.type)];
×
470
    }
471

472
    stride /= 8;
473
  }
474
};
×
475

×
476
std::map<uint32, MODAttributes> fallbackFormats{
×
477
    {
×
478
        // xc3
×
479
        0xc31f2014, // P3s_W1s_N3c_B1c_T3c_B1c_U2h
×
480
        {
×
481
            VertexQPosition,
×
482
            V{D::R16, F::NORM, U::BoneWeights},
483
            VertexNormal3,
484
            V{D::R8, F::UINT, U::BoneIndices},
×
485
            VertexTangent3,
×
486
            V{D::R8, F::UINT, U::BoneIndices},
×
487
            TexCoord,
×
488
        },
×
489
    },
×
490
    {
×
491
        // xd2 be, this might be correct after all
492
        0xd8297028, // P3f_N4c_T4c_U2h
×
493
        {
×
494
            VertexPosition,
495
            VertexNormal,
496
            VertexTangent,
×
497
            TexCoord,
498
            VertexColor,
499
        },
500
    },
501
};
502

503
std::map<uint32, MODAttributes> formats{
504
    {
505
        0x64593022, // P3s_W1s_N4c_T4c_B4c_U2h_W2h_unk_U2h_unk
506
        {
×
507
            VertexQPosition,
508
            V{D::R16, F::NORM, U::BoneWeights},
×
509
            VertexNormal,
×
510
            VertexTangent,
×
511
            VertexBoneIndices,
×
512
            TexCoord,
×
513
            V{D::R16G16, F::FLOAT, U::BoneWeights},
×
514
            V{D::R32, F::UINT, U::Undefined},
×
515
            TexCoord,
516
            V{D::R32, F::UINT, U::Undefined},
×
517
        },
×
518
    },
519
    {
520
        0x64593023, // P3s_W1s_N4c_T4c_B4c_U2h_W2h_unk_U2h_unk
×
521
        {
522
            VertexQPosition,
523
            V{D::R16, F::NORM, U::BoneWeights},
×
524
            VertexNormal,
×
525
            VertexTangent,
526
            VertexBoneIndices,
×
527
            TexCoord,
528
            V{D::R16G16, F::FLOAT, U::BoneWeights},
×
529
            V{D::R32, F::UINT, U::Undefined},
×
530
            TexCoord,
×
531
            V{D::R32, F::UINT, U::Undefined},
532
        },
533
    },
534
    {
×
535
        0x64593025, // P3s_W1s_N4c_T4c_B4c_U2h_W2h_unk_U2h_unk
536
        {
×
537
            VertexQPosition,
538
            V{D::R16, F::NORM, U::BoneWeights},
539
            VertexNormal,
540
            VertexTangent,
×
541
            VertexBoneIndices,
542
            TexCoord,
543
            V{D::R16G16, F::FLOAT, U::BoneWeights},
544
            V{D::R32, F::UINT, U::Undefined},
545
            TexCoord,
×
546
            V{D::R32, F::UINT, U::Undefined},
×
547
        },
×
548
    },
×
549
    {
×
550
        0x14d40020, // P3s_W1s_N4c_T4c_B4c_U2h_W2h
×
551
        {
×
552
            VertexQPosition,
×
553
            V{D::R16, F::NORM, U::BoneWeights},
554
            VertexNormal,
555
            VertexTangent,
×
556
            VertexBoneIndices,
×
557
            TexCoord,
×
558
            V{D::R16G16, F::FLOAT, U::BoneWeights},
×
559
        },
×
560
    },
×
561
    {
×
562
        0x14d40022, // P3s_W1s_N4c_T4c_B4c_U2h_W2h
563
        {
×
564
            VertexQPosition,
×
565
            V{D::R16, F::NORM, U::BoneWeights},
566
            VertexNormal,
567
            VertexTangent,
×
568
            VertexBoneIndices,
569
            TexCoord,
570
            V{D::R16G16, F::FLOAT, U::BoneWeights},
571
        },
572
    },
573
    {
574
        0x14d40019, // P3s_W1s_N4c_T4c_B4c_U2h_W2h
575
        {
576
            VertexQPosition,
577
            V{D::R16, F::NORM, U::BoneWeights},
×
578
            VertexNormal,
579
            VertexTangent,
×
580
            VertexBoneIndices,
×
581
            TexCoord,
×
582
            V{D::R16G16, F::FLOAT, U::BoneWeights},
×
583
        },
×
584
    },
×
585
    {
×
586
        0x14d4001f, // P3s_W1s_N4c_T4c_B4c_U2h_W2h
587
        {
×
588
            VertexQPosition,
×
589
            V{D::R16, F::NORM, U::BoneWeights},
590
            VertexNormal,
591
            VertexTangent,
×
592
            VertexBoneIndices,
593
            TexCoord,
594
            V{D::R16G16, F::FLOAT, U::BoneWeights},
×
595
        },
×
596
    },
597
    {
×
598
        0x14d40021, // P3s_W1s_N4c_T4c_B4c_U2h_W2h
599
        {
×
600
            VertexQPosition,
×
601
            V{D::R16, F::NORM, U::BoneWeights},
×
602
            VertexNormalSigned,
603
            VertexTangentSigned,
604
            VertexBoneIndices,
605
            TexCoord,
×
606
            V{D::R16G16, F::FLOAT, U::BoneWeights},
607
        },
×
608
    },
609
    {
610
        0xbde5301a, // P3s_W1s_N4c_T4c_B4c_U2h_W2h
611
        {
×
612
            VertexQPosition,
613
            V{D::R16, F::NORM, U::BoneWeights},
614
            VertexNormal,
615
            VertexTangent,
616
            VertexBoneIndices,
×
617
            TexCoord,
×
618
            V{D::R16G16, F::FLOAT, U::BoneWeights},
×
619
        },
×
620
    },
×
621
    {
×
622
        0xd86ca01c, // P3s_W1s_N4c_T4c_B4c_U2h_W2h_VC4c
×
623
        {
×
624
            VertexQPosition,
625
            V{D::R16, F::NORM, U::BoneWeights},
626
            VertexNormal,
×
627
            VertexTangent,
×
628
            VertexBoneIndices,
×
629
            TexCoord,
×
630
            V{D::R16G16, F::FLOAT, U::BoneWeights},
×
631
            VertexColor,
×
632
        },
×
633
    },
634
    {
×
635
        0x77d87021, // P3s_W1s_N4c_T4c_B4c_U2h_W2h_VC4c
×
636
        {
637
            VertexQPosition,
638
            V{D::R16, F::NORM, U::BoneWeights},
×
639
            VertexNormal,
640
            VertexTangent,
641
            VertexBoneIndices,
642
            TexCoord,
643
            V{D::R16G16, F::FLOAT, U::BoneWeights},
644
            VertexColor,
645
        },
646
    },
647
    {
648
        0x77d87024, // P3s_W1s_N4c_T4c_B4c_U2h_W2h_VC4c
×
649
        {
650
            VertexQPosition,
×
651
            V{D::R16, F::NORM, U::BoneWeights},
×
652
            VertexNormal,
×
653
            VertexTangent,
×
654
            VertexBoneIndices,
×
655
            TexCoord,
×
656
            V{D::R16G16, F::FLOAT, U::BoneWeights},
×
657
            VertexColor,
658
        },
×
659
    },
×
660
    {
661
        0x77d87022, // P3s_W1s_N4c_T4c_B4c_U2h_W2h_VC4c
662
        {
×
663
            VertexQPosition,
664
            V{D::R16, F::NORM, U::BoneWeights},
665
            VertexNormal,
×
666
            VertexTangent,
×
667
            VertexBoneIndices,
668
            TexCoord,
×
669
            V{D::R16G16, F::FLOAT, U::BoneWeights},
670
            VertexColor,
×
671
        },
×
672
    },
×
673
    {
674
        0x77d87023, // P3s_W1s_N4c_T4c_B4c_U2h_W2h_VC4c
675
        {
676
            VertexQPosition,
×
677
            V{D::R16, F::NORM, U::BoneWeights},
678
            VertexNormalSigned,
×
679
            VertexTangentSigned,
680
            VertexBoneIndices,
681
            TexCoord,
682
            V{D::R16G16, F::FLOAT, U::BoneWeights},
×
683
            VertexColor,
684
        },
685
    },
686
    {
687
        0x207d6036, // P3f_N4c_U2h_VC4c
×
688
        {
×
689
            VertexPosition,
×
690
            V{D::R32, F::UINT, U::Undefined}, // polar ts?
×
691
            TexCoord,
×
692
            VertexColor,
×
693
        },
×
694
    },
×
695
    {
696
        0x207d603b, // P3f_N4c_U2h_VC4c
697
        {
×
698
            VertexPosition,
×
699
            V{D::R32, F::UINT, U::Undefined}, // polar ts?
×
700
            TexCoord,
×
701
            VertexColor,
×
702
        },
×
703
    },
×
704
    {
705
        0x207d6037, // P3f_N4c_U2h_VC4c
×
706
        {
×
707
            VertexPosition,
708
            VertexNormal,
709
            TexCoord,
×
710
            VertexColor,
711
        },
712
    },
713
    {
714
        0x207d6030, // P3f_N4c_U2h_VC4c
715
        {
716
            VertexPosition,
717
            VertexNormal,
718
            TexCoord,
719
            VertexColor,
×
720
        },
721
    },
×
722
    {
×
723
        0x207d6038, // P3f_N4c_U2h_VC4c
×
724
        {
×
725
            VertexPosition,
×
726
            VertexNormalSigned,
×
727
            TexCoord,
×
728
            VertexColor,
729
        },
×
730
    },
×
731
    {
732
        0x2f55c03d, // P3s_W1s_N4c_T4c_B4c_U2h_W2h_unk36c
733
        {
×
734
            VertexQPosition,
735
            V{D::R16, F::NORM, U::BoneWeights},
736
            VertexNormal,
×
737
            VertexTangent,
×
738
            VertexBoneIndices,
739
            TexCoord,
×
740
            V{D::R16G16, F::FLOAT, U::BoneWeights},
741
            V{D::R32, F::UINT, U::Undefined},
×
742
            V{D::R32G32B32A32, F::UINT, U::Undefined},
×
743
            V{D::R32G32B32A32, F::UINT, U::Undefined},
×
744
        },
745
    },
746
    {
747
        0x49b4f028, // P3f_N4c_T4c_U2h_VC4c
×
748
        {
749
            VertexPosition,
×
750
            VertexNormal,
751
            VertexTangent,
752
            TexCoord,
753
            VertexColor,
×
754
        },
755
    },
756
    {
757
        0x49b4f02d, // P3f_N4c_T4c_U2h_VC4c
758
        {
×
759
            VertexPosition,
×
760
            VertexNormal,
×
761
            VertexTangent,
×
762
            TexCoord,
×
763
            VertexColor,
×
764
        },
×
765
    },
×
766
    {
767
        0x49b4f029, // P3f_N4c_T4c_U2h_VC4c
768
        {
×
769
            VertexPosition,
×
770
            VertexNormal,
×
771
            VertexTangent,
×
772
            TexCoord,
×
773
            VertexColor,
×
774
        },
×
775
    },
776
    {
×
777
        0x49b4f00e, // P3f_N4c_T4c_U2h_VC4c
×
778
        {
779
            VertexPosition,
780
            VertexNormalSigned,
×
781
            VertexTangentSigned,
782
            TexCoord,
783
            VertexColor,
784
        },
785
    },
786
    {
787
        0x49b4f022, // P3f_N4c_T4c_U2h_VC4c
788
        {
789
            VertexPosition,
790
            VertexNormal,
×
791
            VertexTangent,
792
            TexCoord,
×
793
            VertexColor,
×
794
        },
×
795
    },
×
796
    {
×
797
        0x49b4f02a, // P3f_N4c_T4c_U2h_VC4c
×
798
        {
×
799
            VertexPosition,
800
            VertexNormalSigned,
×
801
            VertexTangentSigned,
×
802
            TexCoord,
803
            VertexColor,
804
        },
×
805
    },
806
    {
807
        0x49b4f015, // P3f_N4c_T4c_U2h_VC4c
×
808
        {
×
809
            VertexPosition,
810
            VertexNormalSigned,
×
811
            VertexTangentSigned,
812
            TexCoord,
×
813
            VertexColor,
×
814
        },
×
815
    },
816
    {
817
        0x5e7f202c, // P3f_N4c_T4c_U2h_U2h
818
        {
×
819
            VertexPosition,
820
            VertexNormal,
×
821
            VertexTangent,
822
            TexCoord,
823
            TexCoord,
×
824
        },
825
    },
×
826
    {
×
827
        0x5e7f202d, // P3f_N4c_T4c_U2h_U2h
828
        {
829
            VertexPosition,
×
830
            VertexNormalSigned,
831
            VertexTangentSigned,
×
832
            TexCoord,
×
833
            TexCoord,
834
        },
835
    },
×
836
    {
837
        0x5e7f2030, // P3f_N4c_T4c_U2h_U2h
×
838
        {
×
839
            VertexPosition,
×
840
            VertexNormal,
×
841
            VertexTangent,
842
            TexCoord,
843
            TexCoord,
×
844
        },
845
    },
×
846
    {
×
847
        0x747d1031, // P3f_N4c_T4c_U2h_U2h_U2h
×
848
        {
×
849
            VertexPosition,
850
            VertexNormal,
851
            VertexTangent,
126✔
852
            TexCoord,
853
            TexCoord,
854
            TexCoord,
855
        },
127✔
856
    },
943✔
857
    {
816✔
858
        0x75c3e025, // P3s_W1s_N4c_W4c_B8c_U2h_W2h_T4c_U2h
859
        {
860
            VertexQPosition,
127✔
861
            V{D::R16, F::NORM, U::BoneWeights},
127✔
862
            VertexNormal,
863
            V{D::R8G8B8A8, F::UNORM, U::BoneWeights},
864
            VertexBoneIndices,
865
            VertexBoneIndices,
866
            TexCoord,
867
            V{D::R16G16, F::FLOAT, U::BoneWeights},
868
            VertexTangent,
869
            TexCoord,
870
        },
871
    },
872
    {
873
        0x926fd02d, // P3f_N4c_T4c_U2h_U2h_VC4c
874
        {
875
            VertexPosition,
876
            VertexNormal,
877
            VertexTangent,
878
            TexCoord,
879
            TexCoord,
880
            VertexColor,
881
        },
882
    },
883
    {
884
        0x926fd032, // P3f_N4c_T4c_U2h_U2h_VC4c
885
        {
886
            VertexPosition,
887
            VertexNormal,
888
            VertexTangent,
889
            TexCoord,
890
            TexCoord,
891
            VertexColor,
892
        },
893
    },
894
    {
895
        0x926fd02e, // P3f_N4c_T4c_U2h_U2h_VC4c
896
        {
897
            VertexPosition,
898
            VertexNormal,
899
            VertexTangent,
900
            TexCoord,
901
            TexCoord,
902
            VertexColor,
903
        },
904
    },
905
    {
906
        0xb86de02a, // P3f_N4c_T4c_U2h_U2h_VC4c
907
        {
908
            VertexPosition,
909
            VertexNormal,
910
            VertexTangent,
911
            TexCoord,
912
            TexCoord,
913
            VertexColor,
914
        },
915
    },
916
    {
917
        0xCBCF7026, // P3s_W1s_N4c_W4c_B8c_U2h_W2h_T4c_unk1i_U2h_unk1i
918
        {
919
            VertexQPosition,
920
            V{D::R16, F::NORM, U::BoneWeights},
921
            VertexNormal,
922
            V{D::R8G8B8A8, F::UNORM, U::BoneWeights},
923
            VertexBoneIndices,
924
            VertexBoneIndices,
925
            TexCoord,
926
            V{D::R16G16, F::FLOAT, U::BoneWeights},
927
            VertexTangent,
928
            V{D::R32, F::UINT, U::Undefined},
929
            TexCoord,
930
            V{D::R32, F::UINT, U::Undefined},
931
        },
932
    },
933
    {
934
        0xCBCF702A, // P3s_W1s_N4c_W4c_B8c_U2h_W2h_T4c_unk1i_U2h_unk1i
935
        {
936
            VertexQPosition,
937
            V{D::R16, F::NORM, U::BoneWeights},
938
            VertexNormal,
939
            V{D::R8G8B8A8, F::UNORM, U::BoneWeights},
940
            VertexBoneIndices,
941
            VertexBoneIndices,
942
            TexCoord,
943
            V{D::R16G16, F::FLOAT, U::BoneWeights},
944
            VertexTangent,
945
            V{D::R32, F::UINT, U::Undefined},
946
            TexCoord,
947
            V{D::R32, F::UINT, U::Undefined},
948
        },
949
    },
950
    {
951
        0xCBCF7027, // P3s_W1s_N4c_W4c_B8c_U2h_W2h_T4c_unk1i_U2h_unk1i
952
        {
953
            VertexQPosition,
954
            V{D::R16, F::NORM, U::BoneWeights},
955
            VertexNormal,
956
            V{D::R8G8B8A8, F::UNORM, U::BoneWeights},
957
            VertexBoneIndices,
958
            VertexBoneIndices,
959
            TexCoord,
960
            V{D::R16G16, F::FLOAT, U::BoneWeights},
961
            VertexTangent,
962
            V{D::R32, F::UINT, U::Undefined},
963
            TexCoord,
964
            V{D::R32, F::UINT, U::Undefined},
965
        },
966
    },
967
    {
968
        0xbb424023, // P3s_W1s_N4c_W4c_B8c_U2h_W2h_T4c
969
        {
970
            VertexQPosition,
971
            V{D::R16, F::NORM, U::BoneWeights},
972
            VertexNormal,
973
            V{D::R8G8B8A8, F::UNORM, U::BoneWeights},
974
            VertexBoneIndices,
975
            VertexBoneIndices,
976
            TexCoord,
977
            V{D::R16G16, F::FLOAT, U::BoneWeights},
978
            VertexTangent,
979
        },
980
    },
981
    {
982
        0xbb424027, // P3s_W1s_N4c_W4c_B8c_U2h_W2h_T4c
983
        {
984
            VertexQPosition,
985
            V{D::R16, F::NORM, U::BoneWeights},
986
            VertexNormal,
987
            V{D::R8G8B8A8, F::UNORM, U::BoneWeights},
988
            VertexBoneIndices,
989
            VertexBoneIndices,
990
            TexCoord,
991
            V{D::R16G16, F::FLOAT, U::BoneWeights},
992
            VertexTangent,
993
        },
994
    },
995
    {
996
        0xbb424024, // P3s_W1s_N4c_W4c_B8c_U2h_W2h_T4c
997
        {
998
            VertexQPosition,
999
            V{D::R16, F::NORM, U::BoneWeights},
1000
            VertexNormal,
1001
            V{D::R8G8B8A8, F::UNORM, U::BoneWeights},
1002
            VertexBoneIndices,
1003
            VertexBoneIndices,
1004
            TexCoord,
1005
            V{D::R16G16, F::FLOAT, U::BoneWeights},
1006
            VertexTangent,
1007
        },
1008
    },
1009
    {
1010
        0x1273701e, // P3s_W1s_N4c_W4c_B8c_U2h_W2h_T4c
1011
        {
1012
            VertexQPosition,
1013
            V{D::R16, F::NORM, U::BoneWeights},
1014
            VertexNormal,
1015
            V{D::R8G8B8A8, F::UNORM, U::BoneWeights},
1016
            VertexBoneIndices,
1017
            VertexBoneIndices,
1018
            TexCoord,
1019
            V{D::R16G16, F::FLOAT, U::BoneWeights},
1020
            VertexTangent,
1021
        },
1022
    },
1023
    {
1024
        0xbb42401d, // P3s_W1s_N4c_W4c_B8c_U2h_W2h_T4c
1025
        {
1026
            VertexQPosition,
1027
            V{D::R16, F::NORM, U::BoneWeights},
1028
            VertexNormal,
1029
            V{D::R8G8B8A8, F::UNORM, U::BoneWeights},
1030
            VertexBoneIndices,
1031
            VertexBoneIndices,
1032
            TexCoord,
1033
            V{D::R16G16, F::FLOAT, U::BoneWeights},
1034
            VertexTangent,
1035
        },
1036
    },
1037
    {
1038
        0xbb424025, // P3s_W1s_N4c_W4c_B8c_U2h_W2h_T4c
1039
        {
1040
            VertexQPosition,
1041
            V{D::R16, F::NORM, U::BoneWeights},
1042
            VertexNormalSigned,
1043
            V{D::R8G8B8A8, F::UNORM, U::BoneWeights},
1044
            VertexBoneIndices,
1045
            VertexBoneIndices,
1046
            TexCoord,
1047
            V{D::R16G16, F::FLOAT, U::BoneWeights},
1048
            VertexTangentSigned,
1049
        },
1050
    },
1051
    {
1052
        0xb392101f, // P3s_W1s_N4c_T4c_B2h_U2h_U2h_unk2i
1053
        {
1054
            VertexQPosition,
1055
            V{D::R16, F::NORM, U::BoneWeights},
1056
            VertexNormal,
1057
            VertexTangent,
1058
            V{D::R16G16, F::FLOAT, U::BoneIndices},
1059
            TexCoord,
1060
            TexCoord,
1061
            V{D::R32G32, F::UINT, U::Undefined},
1062
        },
1063
    },
1064
    {
1065
        0xb3921020, // P3s_W1s_N4c_T4c_B2h_U2h_U2h_unk2i
1066
        {
1067
            VertexQPosition,
1068
            V{D::R16, F::NORM, U::BoneWeights},
1069
            VertexNormal,
1070
            VertexTangent,
1071
            V{D::R16G16, F::FLOAT, U::BoneIndices},
1072
            TexCoord,
1073
            TexCoord,
1074
            V{D::R32G32, F::UINT, U::Undefined},
1075
        },
1076
    },
1077
    {
1078
        0xda55a020, // P3s_W1s_N4c_T4c_B4c_U2h_W2s_U2h
1079
        {
1080
            VertexQPosition,
1081
            V{D::R16, F::NORM, U::BoneWeights},
1082
            VertexNormal,
1083
            VertexTangent,
1084
            VertexBoneIndices,
1085
            TexCoord,
1086
            V{D::R16G16, F::FLOAT, U::BoneWeights},
1087
            TexCoord,
1088
        },
1089
    },
1090
    {
1091
        0xda55a021, // P3s_W1s_N4c_T4c_B4c_U2h_W2s_U2h
1092
        {
1093
            VertexQPosition,
1094
            V{D::R16, F::NORM, U::BoneWeights},
1095
            VertexNormal,
1096
            VertexTangent,
1097
            VertexBoneIndices,
1098
            TexCoord,
1099
            V{D::R16G16, F::FLOAT, U::BoneWeights},
1100
            TexCoord,
1101
        },
1102
    },
1103
    {
1104
        0xda55a023, // P3s_W1s_N4c_T4c_B4c_U2h_W2s_U2h
1105
        {
1106
            VertexQPosition,
1107
            V{D::R16, F::NORM, U::BoneWeights},
1108
            VertexNormal,
1109
            VertexTangent,
1110
            VertexBoneIndices,
1111
            TexCoord,
1112
            V{D::R16G16, F::FLOAT, U::BoneWeights},
1113
            TexCoord,
1114
        },
1115
    },
1116
    {
1117
        0xd9e801d, // P3s_W1s_N4c_T4c_U2h_B2h_U2h
1118
        {
1119
            VertexQPosition,
1120
            V{D::R16, F::NORM, U::BoneWeights},
1121
            VertexNormal,
1122
            VertexTangent,
1123
            TexCoord,
1124
            V{D::R16G16, F::FLOAT, U::BoneIndices},
1125
            TexCoord,
1126
        },
1127
    },
1128
    {
1129
        0xd9e801e, // P3s_W1s_N4c_T4c_U2h_B2h_U2h
1130
        {
1131
            VertexQPosition,
1132
            V{D::R16, F::NORM, U::BoneWeights},
1133
            VertexNormal,
1134
            VertexTangent,
1135
            TexCoord,
1136
            V{D::R16G16, F::FLOAT, U::BoneIndices},
1137
            TexCoord,
1138
        },
1139
    },
1140
    {
1141
        0xc31f201b, // P3s_W1s_N4c_T4c_U2h_B2h
1142
        {
1143
            VertexQPosition,
1144
            V{D::R16, F::NORM, U::BoneWeights},
1145
            VertexNormal,
1146
            VertexTangent,
1147
            TexCoord,
1148
            V{D::R16G16, F::FLOAT, U::BoneIndices},
1149
        },
1150
    },
1151
    {
1152
        0xc31f201c, // P3s_W1s_N4c_T4c_U2h_B2h
1153
        {
1154
            VertexQPosition,
1155
            V{D::R16, F::NORM, U::BoneWeights},
1156
            VertexNormal,
1157
            VertexTangent,
1158
            TexCoord,
1159
            V{D::R16G16, F::FLOAT, U::BoneIndices},
1160
        },
1161
    },
1162
    {
1163
        0x6a2e1016, // P3s_W1s_N4c_T4c_U2h_B2h
1164
        {
1165
            VertexQPosition,
1166
            V{D::R16, F::NORM, U::BoneWeights},
1167
            VertexNormal,
1168
            VertexTangent,
1169
            TexCoord,
1170
            V{D::R16G16, F::FLOAT, U::BoneIndices},
1171
        },
1172
    },
1173
    {
1174
        0xc31f2014, // P3s_W1s_N4c_T4c_U2h_B2h
1175
        {
1176
            VertexQPosition,
1177
            V{D::R16, F::NORM, U::BoneWeights},
1178
            VertexNormal,
1179
            VertexTangent,
1180
            TexCoord,
1181
            V{D::R16G16, F::FLOAT, U::BoneIndices},
1182
        },
1183
    },
1184
    {
1185
        0xc31f201d, // P3s_W1s_N4c_T4c_U2h_B2h
1186
        {
1187
            VertexQPosition,
1188
            V{D::R16, F::NORM, U::BoneWeights},
1189
            VertexNormalSigned,
1190
            VertexTangentSigned,
1191
            TexCoord,
1192
            V{D::R16G16, F::FLOAT, U::BoneIndices},
1193
        },
1194
    },
1195
    {
1196
        0xa013501d, // P3s_W1s_N4c_T4c_U2h_B2h_VC4c
1197
        {
1198
            VertexQPosition,
1199
            V{D::R16, F::NORM, U::BoneWeights},
1200
            VertexNormal,
1201
            VertexTangent,
1202
            TexCoord,
1203
            V{D::R16G16, F::FLOAT, U::BoneIndices},
1204
            VertexColor,
1205
        },
1206
    },
1207
    {
1208
        0xa013501e, // P3s_W1s_N4c_T4c_U2h_B2h_VC4c
1209
        {
1210
            VertexQPosition,
1211
            V{D::R16, F::NORM, U::BoneWeights},
1212
            VertexNormal,
1213
            VertexTangent,
1214
            TexCoord,
1215
            V{D::R16G16, F::FLOAT, U::BoneIndices},
1216
            VertexColor,
1217
        },
1218
    },
1219
    {
1220
        0xa013501f, // P3s_W1s_N4c_T4c_U2h_B2h_VC4c
1221
        {
1222
            VertexQPosition,
1223
            V{D::R16, F::NORM, U::BoneWeights},
1224
            VertexNormalSigned,
1225
            VertexTangentSigned,
1226
            TexCoord,
1227
            V{D::R16G16, F::FLOAT, U::BoneIndices},
1228
            VertexColor,
1229
        },
1230
    },
1231
    {
1232
        0xd877801a, // P3s_B1s_N4c_T4c_U2h_unk1i_U2h_unk1i
1233
        {
1234
            VertexQPosition,
1235
            V{D::R16, F::UINT, U::BoneIndices},
1236
            VertexNormal,
1237
            VertexTangent,
1238
            TexCoord,
1239
            V{D::R32, F::UINT, U::Undefined},
1240
            TexCoord,
1241
            V{D::R32, F::UINT, U::Undefined},
1242
        },
1243
    },
1244
    {
1245
        0xd877801b, // P3s_B1s_N4c_T4c_U2h_unk1i_U2h_unk1i
1246
        {
1247
            VertexQPosition,
1248
            V{D::R16, F::UINT, U::BoneIndices},
1249
            VertexNormal,
1250
            VertexTangent,
1251
            TexCoord,
1252
            V{D::R32, F::UINT, U::Undefined},
1253
            TexCoord,
1254
            V{D::R32, F::UINT, U::Undefined},
1255
        },
1256
    },
1257
    {
1258
        0xcbf6c019, // P3s_unk1s_T4c_N4c_U2h_VC4c
1259
        {
1260
            VertexQPosition,
1261
            V{D::R16, F::UINT, U::Undefined}, // bone?
1262
            VertexNormal,
1263
            VertexTangent,
1264
            TexCoord,
1265
            VertexColor,
1266
        },
1267
    },
1268
    {
1269
        0xcbf6c01a, // P3s_unk1s_T4c_N4c_U2h_VC4c
1270
        {
1271
            VertexQPosition,
1272
            V{D::R16, F::UINT, U::Undefined}, // bone?
1273
            VertexTangent,
1274
            VertexNormal,
1275
            TexCoord,
1276
            VertexColor,
1277
        },
1278
    },
1279
    {
1280
        0xcbf6c01b, // P3s_unk1s_T4c_N4c_U2h_VC4c
1281
        {
1282
            VertexQPosition,
1283
            V{D::R16, F::UINT, U::Undefined}, // bone?
1284
            VertexTangentSigned,
1285
            VertexNormalSigned,
1286
            TexCoord,
1287
            VertexColor,
1288
        },
1289
    },
1290
    {
1291
        0xcbf6c00e, // P3s_unk1s_T4c_N4c_U2h_VC4c
1292
        {
1293
            VertexQPosition,
1294
            V{D::R16, F::UINT, U::Undefined},
1295
            VertexNormalSigned,
1296
            TexCoord,
1297
            TexCoord,
1298
            VertexColor,
1299
            VertexTangentSigned,
1300
        },
1301
    },
1302
    {
1303
        0x37a4e035, // P3s_N4c_T4c_U2h_U2h_U2h_U2h
1304
        {
1305
            VertexPosition,
1306
            VertexNormal,
1307
            VertexTangent,
1308
            TexCoord,
1309
            TexCoord,
1310
            TexCoord,
1311
            TexCoord,
1312
        },
1313
    },
1314
    {
1315
        0x12553032, // P3s_N4c_T4c_U2h_U2h_U2h
1316
        {
1317
            VertexPosition,
1318
            VertexNormal,
1319
            VertexTangent,
1320
            TexCoord,
1321
            TexCoord,
1322
            TexCoord,
1323
        },
1324
    },
1325
    {
1326
        0xafa6302d, // P3f_N4c_T4c_U2h_U2h
1327
        {
1328
            VertexPosition,
1329
            VertexNormal,
1330
            VertexTangent,
1331
            TexCoord,
1332
            TexCoord,
1333
        },
1334
    },
1335
    {
1336
        0xafa63031, // P3f_N4c_T4c_U2h_U2h
1337
        {
1338
            VertexPosition,
1339
            VertexNormal,
1340
            VertexTangent,
1341
            TexCoord,
1342
            TexCoord,
1343
        },
1344
    },
1345
    {
1346
        0xd8297027, // P3f_N4c_T4c_U2h
1347
        {
1348
            VertexPosition,
1349
            VertexNormal,
1350
            VertexTangent,
1351
            TexCoord,
1352
        },
1353
    },
1354
    {
1355
        0xd829702c, // P3f_N4c_T4c_U2h
1356
        {
1357
            VertexPosition,
1358
            VertexNormal,
1359
            VertexTangent,
1360
            TexCoord,
1361
        },
1362
    },
1363
    {
1364
        0xd8297028, // P3f_N4c_T4c_U2h
1365
        {
1366
            VertexPosition,
1367
            VertexNormal,
1368
            VertexTangent,
1369
            TexCoord,
1370
        },
1371
    },
1372
    {
1373
        0xd8297021, // P3f_N4c_T4c_U2h
1374
        {
1375
            VertexPosition,
1376
            VertexNormal,
1377
            VertexTangent,
1378
            TexCoord,
1379
        },
1380
    },
1381
    {
1382
        0xd8297029, // P3f_N4c_T4c_U2h
1383
        {
1384
            VertexPosition,
1385
            VertexNormalSigned,
1386
            VertexTangentSigned,
1387
            TexCoord,
1388
        },
1389
    },
1390
    {
1391
        0x2082f03b, // P3f_N4c_U2h_U2h_U2h
1392
        {
1393
            VertexPosition,
1394
            VertexNormal,
1395
            TexCoord,
1396
            TexCoord,
1397
            TexCoord,
1398
        },
1399
    },
1400
    {
1401
        0xc66fa03a, // P3f_N4c_U2h_U2h
1402
        {
1403
            VertexPosition,
1404
            VertexNormal,
1405
            TexCoord,
1406
            TexCoord,
1407
        },
1408
    },
1409
    {
1410
        0xc66fa03e, // P3f_N4c_U2h_U2h
1411
        {
1412
            VertexPosition,
1413
            VertexNormal,
1414
            TexCoord,
1415
            TexCoord,
1416
        },
1417
    },
1418
    {
1419
        0xd1a47038, // P3f_N4c_U2h_U2h
1420
        {
1421
            VertexPosition,
1422
            VertexNormal,
1423
            TexCoord,
1424
            TexCoord,
1425
        },
1426
    },
1427
    {
1428
        0xd1a4703c, // P3f_N4c_U2h_U2h
1429
        {
1430
            VertexPosition,
1431
            VertexNormal,
1432
            TexCoord,
1433
            TexCoord,
1434
        },
1435
    },
1436
    {
1437
        0xa7d7d035, // P3f_N4c_U2h
1438
        {
1439
            VertexPosition,
1440
            V{D::R32, F::UINT, U::Undefined}, // polar ts?
1441
            TexCoord,
1442
        },
1443
    },
1444
    {
1445
        0xa7d7d036, // P3f_N4c_U2h
1446
        {
1447
            VertexPosition,
1448
            VertexNormal,
1449
            TexCoord,
1450
        },
1451
    },
1452
    {
1453
        0xa7d7d03a, // P3f_N4c_U2h
1454
        {
1455
            VertexPosition,
1456
            V{D::R32, F::UINT, U::Undefined}, // polar ts?
1457
            TexCoord,
1458
        },
1459
    },
1460
    {
1461
        0xa7d7d02f, // P3f_N4c_U2h
1462
        {
1463
            VertexPosition,
1464
            VertexNormal,
1465
            TexCoord,
1466
        },
1467
    },
1468
    {
1469
        0xa7d7d037, // P3f_N4c_U2h
1470
        {
1471
            VertexPosition,
1472
            VertexNormalSigned,
1473
            TexCoord,
1474
        },
1475
    },
1476
    {
1477
        0xa14e003c, // P3f_N4c_U2h_U2h_VC4c
1478
        {
1479
            VertexPosition,
1480
            VertexNormal,
1481
            TexCoord,
1482
            TexCoord,
1483
            VertexColor,
1484
        },
1485
    },
1486
    {
1487
        0xa14e0040, // P3f_N4c_U2h_U2h_VC4c
1488
        {
1489
            VertexPosition,
1490
            VertexNormal,
1491
            TexCoord,
1492
            TexCoord,
1493
            VertexColor,
1494
        },
1495
    },
1496
    {
1497
        0x9399c033, // P3f_N4c_T4c_U2h_U2h_VC4c
1498
        {
1499
            VertexPosition,
1500
            VertexNormal,
1501
            VertexTangent,
1502
            TexCoord,
1503
            TexCoord,
1504
            VertexColor,
1505
        },
1506
    },
1507
    {
1508
        0x9399c037, // P3f_N4c_T4c_U2h_U2h_VC4c
1509
        {
1510
            VertexPosition,
1511
            VertexNormal,
1512
            VertexTangent,
1513
            TexCoord,
1514
            TexCoord,
1515
            VertexColor,
1516
        },
1517
    },
1518
    {
1519
        0x4325a03e, // P3f_N4c_T4c_U2h_U2h_unk3h_unk1s_unki7
1520
        {
1521
            VertexPosition,
1522
            VertexNormal,
1523
            VertexTangent,
1524
            TexCoord,
1525
            TexCoord,
1526
            V{D::R32G32B32A32, F::UINT, U::Undefined},
1527
            V{D::R32G32B32A32, F::UINT, U::Undefined},
1528
            V{D::R32, F::UINT, U::Undefined},
1529
        },
1530
    },
1531
    {
1532
        0xb6681034, // P3f_N4c_T4c_U2h_U2h_VC4c_U2h
1533
        {
1534
            VertexPosition,
1535
            VertexNormal,
1536
            VertexTangent,
1537
            TexCoord,
1538
            TexCoord,
1539
            VertexColor,
1540
            TexCoord,
1541
        },
1542
    },
1543
    {
1544
        0xb6681038, // P3f_N4c_T4c_U2h_U2h_VC4c_U2h
1545
        {
1546
            VertexPosition,
1547
            VertexNormal,
1548
            VertexTangent,
1549
            TexCoord,
1550
            TexCoord,
1551
            VertexColor,
1552
            TexCoord,
1553
        },
1554
    },
1555
    {
1556
        0x63b6c02f, // P3f_N4c_T4c_U2h_U2h_U2h_unk1i
1557
        {
1558
            VertexPosition,
1559
            VertexNormal,
1560
            VertexTangent,
1561
            TexCoord,
1562
            TexCoord,
1563
            TexCoord,
1564
            V{D::R32, F::UINT, U::Undefined},
1565
        },
1566
    },
1567
    {
1568
        0x63b6c033, // P3f_N4c_T4c_U2h_U2h_U2h_unk1i
1569
        {
1570
            VertexPosition,
1571
            VertexNormal,
1572
            VertexTangent,
1573
            TexCoord,
1574
            TexCoord,
1575
            TexCoord,
1576
            V{D::R32, F::UINT, U::Undefined},
1577
        },
1578
    },
1579
    {
1580
        0xa8fab017, // P3f_1s_N4c_T4c_U2h
1581
        {
1582
            VertexQPosition,
1583
            V{D::R16, F::UINT, U::BoneIndices},
1584
            VertexNormal,
1585
            VertexTangent,
1586
            TexCoord,
1587
        },
1588
    },
1589
    {
1590
        0xa8fab018, // P3f_1s_N4c_T4c_U2h
1591
        {
1592
            VertexQPosition,
1593
            V{D::R16, F::UINT, U::BoneIndices},
1594
            VertexNormal,
1595
            VertexTangent,
1596
            TexCoord,
1597
        },
1598
    },
1599
    {
1600
        0xa8fab010, // P3f_1s_N4c_T4c_U2h
1601
        {
1602
            VertexQPosition,
1603
            V{D::R16, F::UINT, U::BoneIndices},
1604
            VertexNormal,
1605
            VertexTangent,
1606
            TexCoord,
1607
        },
1608
    },
1609
    {
1610
        0xa8fab019, // P3f_1s_N4c_T4c_U2h
1611
        {
1612
            VertexQPosition,
1613
            V{D::R16, F::UINT, U::BoneIndices},
1614
            VertexNormalSigned,
1615
            VertexTangentSigned,
1616
            TexCoord,
1617
        },
1618
    },
1619
    {
1620
        0x1cb8011, // P3s_B1s_N4c_T4c_U2h
1621
        {
1622
            VertexQPosition,
1623
            V{D::R16, F::UINT, U::BoneIndices},
1624
            VertexNormal,
1625
            VertexTangent,
1626
            TexCoord,
1627
        },
1628
    },
1629
    {
1630
        0x1cb8011, // P3s_B1s_N4c_T4c_U2h_U2h
1631
        {
1632
            VertexQPosition,
1633
            V{D::R16, F::UINT, U::BoneIndices},
1634
            VertexNormal,
1635
            VertexTangent,
1636
            TexCoord,
1637
            TexCoord,
1638
        },
1639
    },
1640
    {
1641
        0xd84e3026, // P3s_W1s_N4c_W4c_B8c_U2h_W2h_T4c_VC4c
1642
        {
1643
            VertexQPosition,
1644
            V{D::R16, F::NORM, U::BoneWeights},
1645
            VertexNormal,
1646
            V{D::R8G8B8A8, F::UNORM, U::BoneWeights},
1647
            VertexBoneIndices,
1648
            VertexBoneIndices,
1649
            TexCoord,
1650
            V{D::R16G16, F::FLOAT, U::BoneWeights},
1651
            VertexTangent,
1652
            VertexColor,
1653
        },
1654
    },
1655
    {
1656
        0xd84e3027, // P3s_W1s_N4c_W4c_B8c_U2h_W2h_T4c_VC4c
1657
        {
1658
            VertexQPosition,
1659
            V{D::R16, F::NORM, U::BoneWeights},
1660
            VertexNormalSigned,
1661
            V{D::R8G8B8A8, F::UNORM, U::BoneWeights},
1662
            VertexBoneIndices,
1663
            VertexBoneIndices,
1664
            TexCoord,
1665
            V{D::R16G16, F::FLOAT, U::BoneWeights},
1666
            VertexTangentSigned,
1667
            VertexColor,
1668
        },
1669
    },
1670
    {
1671
        0xa8fab009, // P3s_unk1s_N4c_B4c_U2s_T4c
1672
        {
1673
            VertexQPosition,
1674
            V{D::R16, F::UINT, U::Undefined},
1675
            VertexNormalSigned,
1676
            VertexBoneIndices,
1677
            TexCoordPhone,
1678
            VertexTangentSigned,
1679
        },
1680
    },
1681
    {
1682
        0xAE62600B, // P3s_unk1s_N4c_T4c_B4c_W4c_U2h
1683
        {
1684
            VertexQPosition,
1685
            V{D::R16, F::UINT, U::Undefined},
1686
            VertexNormalSigned,
1687
            VertexTangentSigned,
1688
            VertexBoneIndices,
1689
            V{D::R8G8B8A8, F::UNORM, U::BoneWeights},
1690
            TexCoordPhone,
1691
        },
1692
    },
1693
    {
1694
        0x667B1018, // P3s_unk1s_N4c_VC4c_U2h_T4c
1695
        {
1696
            VertexQPosition,
1697
            V{D::R16, F::UINT, U::Undefined},
1698
            VertexNormal,
1699
            VertexColor,
1700
            TexCoord,
1701
            VertexTangent,
1702
        },
1703
    },
1704
    {
1705
        0x667B1019, // P3s_unk1s_N4c_VC4c_U2h_T4c
1706
        {
1707
            VertexQPosition,
1708
            V{D::R16, F::UINT, U::Undefined},
1709
            VertexNormal,
1710
            VertexColor,
1711
            TexCoord,
1712
            VertexTangent,
1713
        },
1714
    },
1715
    {
1716
        0xF606F017,
1717
        {
1718
            VertexPosition,
1719
            VertexNormalSigned,
1720
            V{D::R32G32, F::FLOAT, U::TextureCoordiante},
1721
            V{D::R8G8, F::UINT, U::BoneIndices},
1722
            V{D::R8G8, F::UNORM, U::BoneWeights},
1723
            VertexTangentSigned,
1724
            V{D::R8G8, F::UINT, U::BoneIndices},
1725
            V{D::R8G8, F::UNORM, U::BoneWeights},
1726
        },
1727
    },
1728
    {
1729
        0x01B36016,
1730
        {
1731
            VertexPosition,
1732
            VertexNormalSigned,
1733
            V{D::R32G32, F::FLOAT, U::TextureCoordiante},
1734
            V{D::R8G8, F::UINT, U::BoneIndices},
1735
            V{D::R8G8, F::UNORM, U::BoneWeights},
1736
            VertexTangentSigned, // always zero?
1737
            V{D::R8G8, F::UINT, U::BoneIndices},
1738
            V{D::R8G8, F::UNORM, U::BoneWeights},
1739
        },
1740
    },
1741
    {
1742
        0xD6784014,
1743
        {
1744
            VertexPosition,
1745
            VertexNormalSigned,
1746
            V{D::R32G32, F::FLOAT, U::TextureCoordiante},
1747
            V{D::R8G8, F::UINT, U::BoneIndices},
1748
            V{D::R8G8, F::UNORM, U::BoneWeights},
1749
        },
1750
    },
1751
    {
1752
        0x82917009,
1753
        {
1754
            VertexPosition,
1755
            VertexNormalSigned,
1756
            V{D::R32G32, F::FLOAT, U::TextureCoordiante},
1757
        },
1758
    },
1759
    {
1760
        0x59DC400B,
1761
        {
1762
            VertexPosition,
1763
            VertexNormalSigned,
1764
            V{D::R32G32, F::FLOAT, U::TextureCoordiante},
1765
            VertexTangentSigned,
1766
        },
1767
    },
1768
    {
1769
        0x43FB3015,
1770
        {
1771
            VertexPosition,
1772
            VertexNormalSigned,
1773
            V{D::R32G32, F::FLOAT, U::TextureCoordiante},
1774
            V{D::R8G8, F::UINT, U::BoneIndices},
1775
            V{D::R8G8, F::UNORM, U::BoneWeights},
1776
            VertexTangentSigned,
1777
        },
1778
    },
1779
    {
1780
        0x7BA7401B,
1781
        {
1782
            VertexPosition,
1783
            VertexNormalSigned,
1784
            V{D::R32G32, F::FLOAT, U::TextureCoordiante},
1785
            V{D::R8G8, F::UINT, U::BoneIndices},
1786
            V{D::R8G8, F::UNORM, U::BoneWeights},
1787
            VertexColor,
1788
        },
1789
    },
1790
    {
1791
        0xAE252019,
1792
        {
1793
            VertexPosition,
1794
            VertexNormalSigned,
1795
            V{D::R32G32, F::FLOAT, U::TextureCoordiante},
1796
            V{D::R8G8, F::UINT, U::BoneIndices},
1797
            V{D::R8G8, F::UNORM, U::BoneWeights},
1798
            VertexTangentSigned,
1799
            V{D::R8G8, F::UINT, U::BoneIndices},
1800
            V{D::R8G8, F::UNORM, U::BoneWeights},
1801
            V{D::R8G8, F::UINT, U::BoneIndices},
1802
            V{D::R8G8, F::UNORM, U::BoneWeights},
1803
            V{D::R8G8, F::UINT, U::BoneIndices},
1804
            V{D::R8G8, F::UNORM, U::BoneWeights},
1805
        },
1806
    },
1807
    {
1808
        0x3D62B012,
1809
        {
1810
            VertexPosition,
1811
            VertexNormalSigned,
1812
            V{D::R32G32, F::FLOAT, U::TextureCoordiante},
1813
            VertexColor,
1814
            VertexTangentSigned, // always zero?
1815
            V{D::R32G32, F::FLOAT, U::TextureCoordiante},
1816
        },
1817
    },
1818
    {
1819
        0x6180300A,
1820
        {
1821
            VertexPosition,
1822
            VertexNormalSigned,
1823
            V{D::R32G32, F::FLOAT, U::TextureCoordiante},
1824
            VertexColor,
1825
            VertexTangentSigned,
1826
        },
1827
    },
1828
    {
1829
        0x3F78800C,
1830
        {
1831
            VertexPosition,
1832
            VertexNormalSigned,
1833
            V{D::R32G32, F::FLOAT, U::TextureCoordiante},
1834
            VertexColor,
1835
            VertexTangentSigned,
1836
        },
1837
    },
1838
    {
1839
        0xEDF6F03C,
1840
        {
1841
            VertexPosition,
1842
            VertexNormal,
1843
            VertexTangent,
1844
            VertexBoneIndices,
1845
            V{D::R8G8B8A8, F::UNORM, U::BoneWeights},
1846
            TexCoord,
1847
        },
1848
    },
1849
    {
1850
        0x3339D03A,
1851
        {
1852
            VertexPosition,
1853
            VertexNormal3,
1854
            V{D::R8, F::UINT, U::BoneIndices},
1855
            TexCoord,
1856
        },
1857
    },
1858
    {
1859
        0xFD35504D,
1860
        {
1861
            VertexPosition,
1862
            VertexNormal,
1863
            Packed(VertexColor),
1864
            TexCoord,
1865
            TexCoord,
1866
        },
1867
    },
1868
    {
1869
        0x682EF04C,
1870
        {
1871
            VertexPosition,
1872
            VertexNormal,
1873
            Packed(VertexColor),
1874
            TexCoord,
1875
        },
1876
    },
1877
    {
1878
        0x707FB01C,
1879
        {
1880
            VertexQPosition,
1881
            V{D::R16, F::UINT, U::Undefined}, // bone id?
1882
            VertexNormal,
1883
            VertexTangent,
1884
            TexCoord,
1885
            V{D::R32, F::UINT, U::Undefined},
1886
            V{D::R32, F::UINT, U::Undefined},
1887
            TexCoord,
1888
            VertexColor,
1889
        },
1890
    },
1891
    {
1892
        0xCC510026,
1893
        {
1894
            VertexQPosition,
1895
            V{D::R16, F::NORM, U::BoneWeights},
1896
            VertexNormal,
1897
            VertexTangent,
1898
            VertexBoneIndices,
1899
            TexCoord,
1900
            V{D::R16G16, F::FLOAT, U::BoneWeights},
1901
            V{D::R32, F::UINT, U::Undefined},
1902
            V{D::R32, F::UINT, U::Undefined},
1903
            TexCoord,
1904
            V{D::R32, F::UINT, U::Undefined},
1905
        },
1906
    },
1907
    {
1908
        0x1B9A2021,
1909
        {
1910
            VertexQPosition,
1911
            V{D::R16, F::NORM, U::BoneWeights},
1912
            VertexNormal,
1913
            VertexTangent,
1914
            V{D::R16G16, F::FLOAT, U::BoneIndices},
1915
            TexCoord,
1916
            V{D::R32, F::UINT, U::Undefined},
1917
            V{D::R32, F::UINT, U::Undefined},
1918
            TexCoord,
1919
            V{D::R32, F::UINT, U::Undefined},
1920
        },
1921
    },
1922
    {
1923
        0xC9CFC012, // P3s_B1s_N4c_T4c_U2h_U2h
1924
        {
1925
            VertexQPosition,
1926
            V{D::R16, F::UINT, U::BoneIndices},
1927
            VertexNormal,
1928
            VertexTangent,
1929
            TexCoord,
1930
            TexCoord,
1931
        },
1932
    },
1933
};
1934

1935
static const std::set<uint32> edgeModels{
1936
    0xdb7da014,
1937
    0xdb7da013,
1938
    0xdb7da00d,
1939
    // P3s_unk1s_B4c_W4c_N4c
1940
    0x0CB68015,
1941
    0x0CB68014,
1942
    0x0CB6800e,
1943
    // P3s_B1s_N4c
1944
    0xB0983013,
1945
    // P3s_unk1s_B8c_W8c_N4c
1946
    0xA320C015,
1947
    0xA320C016,
1948
    0xA320C00F,
1949
    0xB0983014,
1950
    0xB0983012,
1951
    0xB098300C,
1952
};
1953

1954
static const auto makeV2 = [](auto &self, revil::MODImpl &main, auto &&fd) {
1955
  revil::MODPrimitive retval;
1956
  uint8 visibleLOD_ = self.data0.template Get<MODMeshXC5::VisibleLOD>();
1957
  const auto visibleLOD = reinterpret_cast<es::Flags<uint8> &>(visibleLOD_);
1958
  retval.lod1 = visibleLOD[0];
1959
  retval.lod2 = visibleLOD[1];
1960
  retval.lod3 = visibleLOD[2];
1961
  retval.materialIndex = self.data0.template Get<MODMeshXC5::MaterialIndex>();
1962
  const MODMeshXC5::PrimitiveType_e primitiveType = MODMeshXC5::PrimitiveType_e(
1963
      self.data1.template Get<
1964
          typename std::decay_t<decltype(self)>::PrimitiveType>());
1965

1966
  retval.triStrips = primitiveType == MODMeshXC5::PrimitiveType_e::Strips;
1967
  retval.indexIndex = main.indices.size();
1968
  retval.vertexIndex = main.vertices.size();
1969
  retval.meshId = self.meshIndex;
1970
  retval.groupId = self.data0.template Get<MODMeshXC5::GroupID>();
1971
  const size_t vertexStride =
1972
      self.data1.template Get<MODMeshXC5::VertexBufferStride>();
1973

1974
  char *mainBuffer =
1975
      main.vertexBuffer.data() + (self.vertexStart * vertexStride) +
1976
      self.vertexStreamOffset + (self.indexValueOffset * vertexStride);
1977

1978
  auto foundFormat = formats.find(self.vertexFormat);
1979

1980
  if (!es::IsEnd(formats, foundFormat)) {
1981
    if (foundFormat->second.stride != vertexStride) {
1982
      foundFormat = fallbackFormats.find(self.vertexFormat);
1983
      if (es::IsEnd(fallbackFormats, foundFormat)) {
1984
        throw std::runtime_error("Cannot find fallback vertex format: " +
1985
                                 std::to_string(self.vertexFormat));
1986
      }
1987
    }
1988

1989
    MODVertexSpan tmpl;
1990
    tmpl.buffer = mainBuffer;
1991
    tmpl.attrs = foundFormat->second.attrs;
1992
    tmpl.stride = vertexStride;
1993
    tmpl.numVertices = self.numVertices;
1994
    fd(tmpl);
1995
    for (auto &a : tmpl.attrs) {
1996
      a.offset = -1;
1997
    }
1998

1999
    main.vertices.emplace_back(std::move(tmpl));
2000
  } else {
2001
    main.vertices.emplace_back();
2002

2003
    if (!edgeModels.contains(self.vertexFormat)) {
2004
      throw std::runtime_error("Unregistered vertex format: " +
2005
                               std::to_string(self.vertexFormat));
2006
    }
2007
  }
2008

2009
  uint16 *indexBuffer = main.indexBuffer.data() + self.indexStart;
2010

2011
  MODIndexSpan idArray(indexBuffer, self.numIndices);
2012

2013
  for (auto &idx : idArray) {
2014
    if (idx != 0xffff) {
2015
      idx -= self.vertexStart;
2016
    }
2017
  }
2018

2019
  main.indices.emplace_back(idArray);
2020

2021
  return retval;
2022
};
2023

2024
revil::MODPrimitive MODMeshXD2::ReflectLE(revil::MODImpl &main_) {
2025
  auto &main = static_cast<MODInner<MODTraitsXD2> &>(main_);
2026
  return makeV2(*this, main, [&](MODVertexSpan &d) {
2027
    for (auto &a : d.attrs) {
2028
      if (a.usage == AttributeType::BoneIndices && skinBoneBegin) {
2029
        auto mcdx = std::make_unique<AttributeAdd>();
2030
        mcdx->add = skinBoneBegin;
2031
      }
2032
    }
2033
  });
2034
}
2035

2036
revil::MODPrimitive MODMeshXD2::ReflectBE(revil::MODImpl &main_) {
2037
  auto &main = static_cast<MODInner<MODTraitsXD2> &>(main_);
2038
  return makeV2(*this, main, [&](MODVertexSpan &d) {
2039
    for (auto &a : d.attrs) {
2040
      if (a.usage == AttributeType::BoneIndices &&
2041
          skinBoneBegin < main.bones.size()) {
2042
        auto mcdx = std::make_unique<AttributeAdd>();
2043
        mcdx->add = skinBoneBegin;
2044
      }
2045
    }
2046

2047
    swapBuffers(d);
2048
  });
2049
}
2050

2051
revil::MODPrimitive MODMeshXD3PS4::ReflectLE(revil::MODImpl &main_) {
2052
  auto &main = static_cast<MODInner<MODTraitsXD2> &>(main_);
2053
  return makeV2(*this, main, [&](MODVertexSpan &d) {
2054
    for (auto &a : d.attrs) {
2055
      if (a.usage == AttributeType::BoneIndices && skinBoneBegin) {
2056
        auto mcdx = std::make_unique<AttributeAdd>();
2057
        mcdx->add = skinBoneBegin;
2058
      } else if (a.usage == AttributeType::Normal) {
2059
        a.format = VertexNormalSigned.format;
2060
        a.customCodec = nullptr;
2061
      } else if (a.usage == AttributeType::Tangent) {
2062
        a.format = VertexTangentSigned.format;
2063
        a.customCodec = nullptr;
2064
      }
2065
    }
2066
  });
2067
}
2068

2069
revil::MODPrimitive MODMeshXD3::ReflectLE(revil::MODImpl &main_) {
2070
  auto &main = static_cast<MODInner<MODTraitsXD2> &>(main_);
2071
  return makeV2(*this, main, [&](MODVertexSpan &d) {
2072
    for (auto &a : d.attrs) {
2073
      if (a.usage == AttributeType::BoneIndices && skinBoneBegin) {
2074
        auto mcdx = std::make_unique<AttributeAdd>();
2075
        mcdx->add = skinBoneBegin;
2076
      }
2077
    }
2078
  });
2079
}
2080

2081
revil::MODPrimitive MODMeshXC5::ReflectLE(revil::MODImpl &main_) {
2082
  auto &main = static_cast<MODInner<MODTraitsXC5> &>(main_);
2083
  return makeV2(*this, main, [&](MODVertexSpan &) {});
2084
}
2085

2086
revil::MODPrimitive MODMeshXC5::ReflectBE(revil::MODImpl &main_) {
2087
  auto &main = static_cast<MODInner<MODTraitsXC5> &>(main_);
2088
  return makeV2(*this, main, [&](MODVertexSpan &d) { swapBuffers(d); });
2089
}
2090

2091
revil::MODPrimitive MODMeshX06::ReflectLE(revil::MODImpl &main_) {
2092
  auto &main = static_cast<MODInner<MODTraitsXD2> &>(main_);
2093
  auto retval = makeV2(*this, main, [&](MODVertexSpan &) {});
2094
  retval.skinIndex = skinBoneBegin;
2095

2096
  /*auto idxArray = main.Indices()->At(retval.indexIndex);
2097
  std::span<const uint16> indices(
2098
      reinterpret_cast<const uint16 *>(idxArray->RawIndexBuffer()), numIndices);
2099

2100
  bool removeTS = true;
2101

2102
  for (auto d : vtArray.descs) {
2103
    switch (d->Usage()) {
2104
    case AttributeType::Normal: {
2105
      uni::FormatCodec::fvec sampled;
2106
      d->Codec().Sample(sampled, d->RawBuffer(), numVertices, d->Stride());
2107
      for (auto i : indices) {
2108
        if (i == 0xffff) {
2109
          continue;
2110
        }
2111

2112
        auto s = sampled.at(i);
2113
        if (s.Length() > 0.5f) {
2114
          removeTS = false;
2115
          //break;
2116
        } else {
2117
          printf("%i ", i);
2118
        }
2119
      }
2120

2121
      break;
2122
    }
2123

2124
    default:
2125
      break;
2126
    }
2127
  }
2128

2129
  if (removeTS) {
2130
    std::remove_if(vtArray.descs.storage.begin(), vtArray.descs.storage.end(,},
2131
                   [](MODVertexDescriptor &d) {
2132
                     return d.usage == MODVertexDescriptor::Usage_e::Normal;
2133
                   });
2134
    std::remove_if(vtArray.descs.storage.begin(), vtArray.descs.storage.end(,},
2135
                   [](MODVertexDescriptor &d) {
2136
                     return d.usage == MODVertexDescriptor::Usage_e::Tangent;
2137
                   });
2138
  }*/
2139

2140
  return retval;
2141
}
2142

2143
revil::MODPrimitive MODMeshXE5::ReflectBE(revil::MODImpl &main_) {
2144
  auto &main = static_cast<MODInner<MODTraitsXD2> &>(main_);
2145
  auto retval = makeV2(*this, main, [&](MODVertexSpan &d) { swapBuffers(d); });
2146
  retval.skinIndex = numEnvelopes;
2147

2148
  return retval;
2149
}
2150

2151
revil::MODPrimitive MODMeshXE5::ReflectLE(revil::MODImpl &main_) {
2152
  auto &main = static_cast<MODInner<MODTraitsXD2> &>(main_);
2153
  auto retval = makeV2(*this, main, [&](MODVertexSpan &) {});
2154
  retval.skinIndex = numEnvelopes;
2155

2156
  return retval;
2157
}
2158

2159
MOD::MOD() {}
2160
MOD::MOD(MOD &&) = default;
2161
MOD::~MOD() = default;
2162

2163
namespace revil {
2164
std::span<const MODVertexSpan> MOD::Vertices() const { return pi->vertices; }
2165
std::span<const MODIndexSpan> MOD::Indices() const { return pi->indices; }
2166
std::span<const revil::MODPrimitive> MOD::Primitives() const {
2167
  return pi->primitives;
2168
}
2169
std::span<const MODSkinJoints> MOD::SkinJoints() const { return pi->skins; }
2170
std::span<const MODMaterial> MOD::Materials() const { return pi->materialRefs; }
2171
std::span<const es::Matrix44> MOD::InverseBinds() const {
2172
  return pi->transforms;
2173
}
2174
std::span<const es::Matrix44> MOD::Transforms() const { return pi->refPoses; }
2175

2176
std::span<const MODBone> MOD::Bones() const { return pi->simpleBones; }
2177
std::span<const MODGroup> MOD::Groups() const { return pi->groups; }
2178
std::span<const MODEnvelope> MOD::Envelopes() const { return pi->envelopes; }
2179
const MODMetaData &MOD::Metadata() const { return pi->Metadata(); }
2180
} // namespace revil
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc