summaryrefslogtreecommitdiff
path: root/extractor/rsm_format.gd
diff options
context:
space:
mode:
Diffstat (limited to 'extractor/rsm_format.gd')
-rw-r--r--extractor/rsm_format.gd87
1 files changed, 87 insertions, 0 deletions
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