1
0
mirror of https://github.com/DarklightGames/io_scene_psk_psa.git synced 2025-03-02 07:01:27 +01:00

101 lines
2.5 KiB
Python
Raw Normal View History

2019-12-01 18:18:05 -08:00
from typing import List
from ctypes import *
2019-12-01 18:18:05 -08:00
class Vector3(Structure):
_fields_ = [
('x', c_float),
('y', c_float),
('z', c_float),
]
2019-12-01 18:18:05 -08:00
class Quaternion(Structure):
_fields_ = [
('x', c_float),
('y', c_float),
('z', c_float),
('w', c_float),
]
2019-12-01 18:18:05 -08:00
class Psk(object):
class Section(Structure):
_fields_ = [
('name', c_char * 20),
('type_flags', c_int32),
('data_size', c_int32),
('data_count', c_int32)
]
def __init__(self, *args, **kw):
super().__init__(*args, **kw)
self.type_flags = 1999801
class Wedge16(Structure):
_fields_ = [
('point_index', c_int16),
('padding1', c_int16),
('u', c_float),
('v', c_float),
('material_index', c_int8),
('reserved', c_int8),
('padding2', c_int16)
]
class Wedge32(Structure):
_fields_ = [
('point_index', c_int32),
('u', c_float),
('v', c_float),
('material_index', c_int32)
]
2019-12-01 18:18:05 -08:00
class Face(Structure):
_fields_ = [
('wedge_index_1', c_int16),
('wedge_index_2', c_int16),
('wedge_index_3', c_int16),
('material_index', c_int8),
('aux_material_index', c_int8),
('smoothing_groups', c_int32)
]
2019-12-01 18:18:05 -08:00
class Material(Structure):
_fields_ = [
('name', c_char * 64),
('texture_index', c_int32),
('poly_flags', c_int32),
('aux_material', c_int32),
('aux_flags', c_int32),
('lod_bias', c_int32),
('lod_style', c_int32)
]
2019-12-01 18:18:05 -08:00
class Bone(Structure):
_fields_ = [
('name', c_char * 64),
('flags', c_int32),
('children_count', c_int32),
('parent_index', c_int32),
('rotation', Quaternion),
('position', Vector3),
('length', c_float),
('size', Vector3)
]
2019-12-01 18:18:05 -08:00
class Weight(Structure):
_fields_ = [
('weight', c_float),
('point_index', c_int32),
('bone_index', c_int32),
]
2019-12-01 18:18:05 -08:00
def __init__(self):
self.points: List[Vector3] = []
self.wedges: List[Psk.Wedge16] = []
2019-12-01 18:18:05 -08:00
self.faces: List[Psk.Face] = []
self.materials: List[Psk.Material] = []
self.weights: List[Psk.Weight] = []
self.bones: List[Psk.Bone] = []