|
6 | 6 | from ..helpers.ResourceReader import get_resource_data |
7 | 7 | from ..math import Matrix4x4, Vector3 |
8 | 8 | from ..streams import EndianBinaryWriter |
| 9 | +from ..enums import GfxPrimitiveType |
9 | 10 |
|
10 | 11 | class MinMaxAABB: |
11 | 12 | def __init__(self, reader): |
@@ -323,10 +324,11 @@ def __init__(self, reader): |
323 | 324 |
|
324 | 325 |
|
325 | 326 | class SubMesh: |
326 | | - def __init__(self, reader, version): |
| 327 | + def __init__(self, reader): |
| 328 | + version = reader.version |
327 | 329 | self.firstByte = reader.read_u_int() |
328 | 330 | self.indexCount = reader.read_u_int() |
329 | | - self.topology = reader.read_int() |
| 331 | + self.topology = GfxPrimitiveType(reader.read_int()) |
330 | 332 |
|
331 | 333 | if version < (4,): # 4.0 down |
332 | 334 | self.triangleCount = reader.read_u_int() |
@@ -493,12 +495,12 @@ def __init__(self, reader): |
493 | 495 |
|
494 | 496 | if version >= (2018, 3): # 2018.3 and up |
495 | 497 | reader.align_stream() |
496 | | - self.m_StreamData = StreamingInfo(reader) |
| 498 | + self.m_StreamData = StreamingInfo(reader, version) |
497 | 499 |
|
498 | | - # try: |
499 | | - # self.ProcessData() |
500 | | - # except: |
501 | | - # pass |
| 500 | + try: |
| 501 | + self.ProcessData() |
| 502 | + except: |
| 503 | + pass |
502 | 504 |
|
503 | 505 | def ProcessData(self): |
504 | 506 | if self.m_StreamData and self.m_StreamData.path: |
@@ -635,21 +637,21 @@ def DecompressCompressedMesh(self): |
635 | 637 | version = self.version |
636 | 638 | m_CompressedMesh = self.m_CompressedMesh |
637 | 639 | if m_CompressedMesh.m_Vertices.m_NumItems > 0: |
638 | | - m_VertexCount = m_CompressedMesh.m_Vertices.m_NumItems / 3 |
639 | | - m_Vertices = m_CompressedMesh.m_Vertices.UnpackFloats(3, 4) |
| 640 | + self.m_VertexCount = m_CompressedMesh.m_Vertices.m_NumItems / 3 |
| 641 | + self.m_Vertices = m_CompressedMesh.m_Vertices.UnpackFloats(3, 4) |
640 | 642 | # UV |
641 | 643 | if m_CompressedMesh.m_UV.m_NumItems > 0: # |
642 | | - m_UV0 = m_CompressedMesh.m_UV.UnpackFloats(2, 4, 0, m_VertexCount) |
| 644 | + self.m_UV0 = m_CompressedMesh.m_UV.UnpackFloats(2, 4, 0, m_VertexCount) |
643 | 645 | if m_CompressedMesh.m_UV.m_NumItems >= m_VertexCount * 4: # |
644 | | - m_UV1 = m_CompressedMesh.m_UV.UnpackFloats( |
| 646 | + self.m_UV1 = m_CompressedMesh.m_UV.UnpackFloats( |
645 | 647 | 2, 4, m_VertexCount * 2, m_VertexCount |
646 | 648 | ) |
647 | 649 | if m_CompressedMesh.m_UV.m_NumItems >= m_VertexCount * 6: # |
648 | | - m_UV2 = m_CompressedMesh.m_UV.UnpackFloats( |
| 650 | + self.m_UV2 = m_CompressedMesh.m_UV.UnpackFloats( |
649 | 651 | 2, 4, m_VertexCount * 4, m_VertexCount |
650 | 652 | ) |
651 | 653 | if m_CompressedMesh.m_UV.m_NumItems >= m_VertexCount * 8: # |
652 | | - m_UV3 = m_CompressedMesh.m_UV.UnpackFloats( |
| 654 | + self.m_UV3 = m_CompressedMesh.m_UV.UnpackFloats( |
653 | 655 | 2, 4, m_VertexCount * 6, m_VertexCount |
654 | 656 | ) |
655 | 657 | # BindPose |
|
0 commit comments