summaryrefslogtreecommitdiff
path: root/extractor/rsm_format.gd
blob: d3dabb024f8cebe21322a6b26549dc68405ac2e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
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