From e08a29e73ea4f7e6d78e8e7f5a6e7033dbc1f542 Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Mon, 30 Dec 2024 15:15:01 +0100 Subject: next commit --- extractor/rsm_format.gd | 87 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 extractor/rsm_format.gd (limited to 'extractor/rsm_format.gd') diff --git a/extractor/rsm_format.gd b/extractor/rsm_format.gd new file mode 100644 index 0000000..d3dabb0 --- /dev/null +++ b/extractor/rsm_format.gd @@ -0,0 +1,87 @@ +class_name RSMFormat + + +## Byte Length: 4 [br] +## GRAT +var signature: String = "GRSM" + +## Byte Type: u8 [br] +## Byte Length: 2 +var version: Version + +## Byte Type: u32 [br] +## Byte Length: 4 +var animation_length: int + +## Byte Type: u32 [br] +## Byte Length: 4 +var shade_type: int + +## Byte Type: u8 [br] +## Byte Length: 1 +## Versions: [>=1.4] +var alpha: int + +## Byte Type: u8 [br] +## Byte Length: 16 +## Versions: [<2.2] +var reserved: PackedByteArray + +## Byte Type: f32 [br] +## Byte Length: 4 +## Versions: [>=2.2] +var frames_per_second: float + +## Byte Type: u32 [br] +## Byte Length: 4 +## Versions: [<2.3] +var texture_count: int + +## Length: [member texture_count] +## Byte Length: 40 +var texture_names: Array[String] + +## Byte Type: u8 +## Byte Length: 40 +var root_node_name: String + +## Byte Type: u32 [br] +## Byte Length: 4 +## Versions: [>=2.2] +var root_node_count: int + +## Length: [member root_node_count] +## Byte Length: 40 +var root_node_names: Array[String] + +## Byte Type: u32 [br] +## Byte Length: 4 +var node_count: int + +## Length: [member node_count] +var nodes: Array[ModelNode] + + +static func from_bytes(bytes: ByteStream) -> RSMFormat: + var rsm_format = RSMFormat.new() + + bytes.advance(rsm_format.signature.length()) + + @warning_ignore("shadowed_variable") + var version = Version.new() + version.major = bytes.decode_u8() + version.minor = bytes.decode_u8() + rsm_format.version = version + + print(inst_to_dict(rsm_format)) + return rsm_format + + +class ModelNode: + ## Byte Type: u8 [br] + ## Byte Length: 40 + var node_name: String + + ## Byte Type: u8 [br] + ## Byte Length: 40 + var parent_node_name: String -- cgit v1.2.3