-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
287 changed files
with
11,627 additions
and
7,232 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from dataclasses import dataclass | ||
|
||
|
||
@dataclass | ||
class GfxbinHeader: | ||
version: int | ||
dependencies: dict[str, str] | ||
hashes: list[int] | ||
|
||
def __init__(self, reader): | ||
self.version = reader.read() | ||
self.dependencies = reader.read() | ||
|
||
hash_count = reader.read() | ||
self.hashes = [] | ||
for i in range(hash_count): | ||
self.hashes.append(reader.read()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
from dataclasses import dataclass | ||
|
||
from .gmdlbone import GmdlBone | ||
from .gmdlmeshobject import GmdlMeshObject | ||
from .gmdlmodelpart import GmdlModelPart | ||
from .gmdlnode import GmdlNode | ||
from ..gfxbinheader import GfxbinHeader | ||
|
||
|
||
@dataclass | ||
class Gmdl: | ||
header: GfxbinHeader | ||
aabb: list[list[float]] | ||
instance_name_format: int | ||
shader_class_format: int | ||
shader_sampler_description_format: int | ||
shader_parameter_list_format: int | ||
child_class_format: int | ||
bones: list[GmdlBone] | ||
nodes: list[GmdlNode] | ||
unknown: float | ||
gpubin_count: int | ||
gpubin_hashes: list[int] | ||
mesh_objects: list[GmdlMeshObject] | ||
unknown2: bool | ||
name: str | ||
parts: list[GmdlModelPart] | ||
unknown3: float | ||
unknown4: float | ||
unknown5: float | ||
unknown6: float | ||
unknown7: float | ||
gpubin_size_count: int | ||
gpubin_sizes: list[int] | ||
|
||
def __init__(self, reader): | ||
self.header = GfxbinHeader(reader) | ||
self.aabb = [[reader.read(), reader.read(), reader.read()], [reader.read(), reader.read(), reader.read()]] | ||
|
||
if self.header.version < 20220707: | ||
self.instance_name_format = reader.read() | ||
self.shader_class_format = reader.read() | ||
self.shader_sampler_description_format = reader.read() | ||
self.shader_parameter_list_format = reader.read() | ||
self.child_class_format = reader.read() | ||
|
||
bone_count = reader.read() | ||
self.bones = [] | ||
for i in range(bone_count): | ||
self.bones.append(GmdlBone(reader, self.header.version)) | ||
|
||
node_count = reader.read() | ||
self.nodes = [] | ||
for i in range(node_count): | ||
self.nodes.append(GmdlNode(reader, i == 0, self.header.version)) | ||
|
||
if self.header.version >= 20220707: | ||
self.unknown = reader.read() | ||
self.gpubin_count = reader.read() | ||
else: | ||
self.gpubin_count = 1 | ||
|
||
self.gpubin_hashes = [] | ||
for i in range(self.gpubin_count): | ||
self.gpubin_hashes.append(reader.read()) | ||
|
||
mesh_object_count = reader.read() | ||
self.mesh_objects = [] | ||
for i in range(mesh_object_count): | ||
self.mesh_objects.append(GmdlMeshObject(reader, i == 0, self.header.version)) | ||
|
||
self.unknown2 = reader.read() | ||
self.name = reader.read() | ||
|
||
parts_count = reader.read() | ||
self.parts = [] | ||
for i in range(parts_count): | ||
self.parts.append(GmdlModelPart(reader)) | ||
|
||
if self.header.version >= 20220707: | ||
self.unknown3 = reader.read() | ||
self.unknown4 = reader.read() | ||
self.unknown5 = reader.read() | ||
self.unknown6 = reader.read() | ||
self.unknown7 = reader.read() | ||
|
||
self.gpubin_size_count = reader.read() | ||
self.gpubin_sizes = [] | ||
for i in range(self.gpubin_size_count): | ||
self.gpubin_sizes.append(reader.read()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from dataclasses import dataclass | ||
|
||
|
||
@dataclass | ||
class GmdlBone: | ||
name: str | ||
lod_index: int | ||
unique_index: int | ||
|
||
def __init__(self, reader, version: int): | ||
self.name = reader.read() | ||
self.lod_index = reader.read() | ||
|
||
if version >= 20220707: | ||
self.unique_index = reader.read() | ||
else: | ||
self.unique_index = self.lod_index >> 16 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
from dataclasses import dataclass | ||
|
||
from .gmdlmeshpart import GmdlMeshPart | ||
from .gmdlsubgeometry import GmdlSubgeometry | ||
from .gmdlvertexstream import GmdlVertexStream | ||
|
||
|
||
@dataclass | ||
class GmdlMesh: | ||
name: str | ||
unknown: int | ||
bone_ids: list[int] | ||
vertex_layout_type: int | ||
unknown2: bool | ||
AABB: list[list[float]] | ||
is_oriented_bb: bool | ||
orientedBB: list[list[float]] | ||
primitive_type: int | ||
face_index_count: int | ||
face_index_type: int | ||
gpubin_index: int | ||
face_index_offset: int | ||
face_index_size: int | ||
vertex_count: int | ||
vertex_streams: list[GmdlVertexStream] | ||
vertex_buffer_offset: int | ||
vertex_buffer_size: int | ||
instance_number: int | ||
subgeometry_count: int | ||
subgeometries: list[GmdlSubgeometry] | ||
unknown6: int | ||
unknown_offset: int | ||
unknown_size: int | ||
material_hash: int | ||
draw_priority_offset: int | ||
unknown7: bool | ||
unknown8: bool | ||
lod_near: float | ||
lod_far: float | ||
lod_fade: float | ||
unknown11: bool | ||
unknown12: bool | ||
parts_id: int | ||
parts: list[GmdlMeshPart] | ||
unknown9: bool | ||
flags: int | ||
unknown10: bool | ||
breakable_bone_index: int | ||
low_lod_shadow_cascade_no: int | ||
|
||
def __init__(self, reader, version: int): | ||
self.name = reader.read() | ||
|
||
if version < 20220707: | ||
self.unknown = reader.read() | ||
bone_id_count = reader.read() | ||
self.bone_ids = [] | ||
for i in range(bone_id_count): | ||
self.bone_ids.append(reader.read()) | ||
|
||
self.vertex_layout_type = reader.read() | ||
self.unknown2 = reader.read() | ||
|
||
self.AABB = [ | ||
[reader.read(), reader.read(), reader.read()], | ||
[reader.read(), reader.read(), reader.read()] | ||
] | ||
|
||
self.is_oriented_bb = reader.read() | ||
|
||
self.orientedBB = [ | ||
[reader.read(), reader.read(), reader.read()], | ||
[reader.read(), reader.read(), reader.read()], | ||
[reader.read(), reader.read(), reader.read()], | ||
[reader.read(), reader.read(), reader.read()] | ||
] | ||
|
||
self.primitive_type = reader.read() | ||
self.face_index_count = reader.read() | ||
self.face_index_type = reader.read() | ||
|
||
if version >= 20220707: | ||
self.gpubin_index = reader.read() | ||
else: | ||
self.gpubin_index = 0 | ||
|
||
self.face_index_offset = reader.read() | ||
self.face_index_size = reader.read() | ||
self.vertex_count = reader.read() | ||
|
||
vertex_stream_count = reader.read() | ||
self.vertex_streams = [] | ||
for i in range(vertex_stream_count): | ||
self.vertex_streams.append(GmdlVertexStream(reader)) | ||
|
||
self.vertex_buffer_offset = reader.read() | ||
self.vertex_buffer_size = reader.read() | ||
|
||
if version < 20220707: | ||
self.instance_number = reader.read() | ||
|
||
self.subgeometry_count = reader.read() | ||
self.subgeometries = [] | ||
for i in range(self.subgeometry_count): | ||
self.subgeometries.append(GmdlSubgeometry(reader)) | ||
|
||
if version >= 20220707: | ||
self.unknown6 = reader.read() | ||
self.unknown_offset = reader.read() | ||
self.unknown_size = reader.read() | ||
|
||
self.material_hash = reader.read() | ||
self.draw_priority_offset = reader.read() | ||
self.unknown7 = reader.read() | ||
self.unknown8 = reader.read() | ||
self.lod_near = reader.read() | ||
self.lod_far = reader.read() | ||
self.lod_fade = reader.read() | ||
|
||
if version < 20220707: | ||
self.unknown11 = reader.read() | ||
self.unknown12 = reader.read() | ||
|
||
self.parts_id = reader.read() | ||
parts_count = reader.read() | ||
self.parts = [] | ||
for i in range(parts_count): | ||
self.parts.append(GmdlMeshPart(reader)) | ||
|
||
self.unknown9 = reader.read() | ||
self.flags = reader.read() | ||
self.unknown10 = reader.read() | ||
self.breakable_bone_index = reader.read() | ||
self.low_lod_shadow_cascade_no = reader.read() |
29 changes: 29 additions & 0 deletions
29
Flagrum.Blender/import_export/gfxbin/gmdl/gmdlmeshobject.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
from dataclasses import dataclass | ||
|
||
from .gmdlmesh import GmdlMesh | ||
|
||
|
||
@dataclass | ||
class GmdlMeshObject: | ||
unknown: bool | ||
name: str | ||
clusters: list[str] | ||
meshes: list[GmdlMesh] | ||
|
||
def __init__(self, reader, is_first, version: int): | ||
if is_first: | ||
self.unknown = False | ||
else: | ||
self.unknown = reader.read() | ||
|
||
self.name = reader.read() | ||
|
||
cluster_count = reader.read() | ||
self.clusters = [] | ||
for i in range(cluster_count): | ||
self.clusters.append(reader.read()) | ||
|
||
mesh_count = reader.read() | ||
self.meshes = [] | ||
for i in range(mesh_count): | ||
self.meshes.append(GmdlMesh(reader, version)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from dataclasses import dataclass | ||
|
||
|
||
@dataclass | ||
class GmdlMeshPart: | ||
parts_id: int | ||
start_index: int | ||
index_count: int | ||
|
||
def __init__(self, reader): | ||
self.parts_id = reader.read() | ||
self.start_index = reader.read() | ||
self.index_count = reader.read() |
15 changes: 15 additions & 0 deletions
15
Flagrum.Blender/import_export/gfxbin/gmdl/gmdlmodelpart.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from dataclasses import dataclass | ||
|
||
|
||
@dataclass | ||
class GmdlModelPart: | ||
name: str | ||
id: int | ||
unknown: str | ||
flags: bool | ||
|
||
def __init__(self, reader): | ||
self.name = reader.read() | ||
self.id = reader.read() | ||
self.unknown = reader.read() | ||
self.flags = reader.read() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from dataclasses import dataclass | ||
|
||
|
||
@dataclass | ||
class GmdlNode: | ||
matrix: list[list[float]] | ||
unknown: float | ||
name: str | ||
unknown2: int | ||
unknown3: int | ||
unknown4: int | ||
|
||
def __init__(self, reader, is_first: bool, version: int): | ||
self.matrix = [ | ||
[reader.read(), reader.read(), reader.read()], | ||
[reader.read(), reader.read(), reader.read()], | ||
[reader.read(), reader.read(), reader.read()], | ||
[reader.read(), reader.read(), reader.read()] | ||
] | ||
|
||
if is_first: | ||
self.unknown = 0.0 | ||
elif version >= 20220707: | ||
self.unknown = reader.read() | ||
|
||
self.name = reader.read() | ||
|
||
if version >= 20220707: | ||
self.unknown2 = reader.read() | ||
self.unknown3 = reader.read() | ||
self.unknown4 = reader.read() |
17 changes: 17 additions & 0 deletions
17
Flagrum.Blender/import_export/gfxbin/gmdl/gmdlsubgeometry.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from dataclasses import dataclass | ||
|
||
|
||
@dataclass | ||
class GmdlSubgeometry: | ||
AABB: list[list[float]] | ||
start_index: int | ||
primitive_count: int | ||
cluster_index_bitflag: int | ||
draw_order: int | ||
|
||
def __init__(self, reader): | ||
self.AABB = [[reader.read(), reader.read(), reader.read()], [reader.read(), reader.read(), reader.read()]] | ||
self.start_index = reader.read() | ||
self.primitive_count = reader.read() | ||
self.cluster_index_bitflag = reader.read() | ||
self.draw_order = reader.read() |
15 changes: 15 additions & 0 deletions
15
Flagrum.Blender/import_export/gfxbin/gmdl/gmdlvertexelement.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from dataclasses import dataclass | ||
|
||
from .gmdlvertexelementformat import ElementFormat | ||
|
||
|
||
@dataclass | ||
class GmdlVertexElement: | ||
offset: int | ||
semantic: str | ||
format: ElementFormat | ||
|
||
def __init__(self, reader): | ||
self.offset = reader.read() | ||
self.semantic = reader.read() | ||
self.format = ElementFormat(reader.read()) |
Oops, something went wrong.