diff options
Diffstat (limited to 'extractor/rsw_format.gd')
-rw-r--r-- | extractor/rsw_format.gd | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/extractor/rsw_format.gd b/extractor/rsw_format.gd index ea1bf26..831a1cb 100644 --- a/extractor/rsw_format.gd +++ b/extractor/rsw_format.gd @@ -105,6 +105,40 @@ static func from_bytes(bytes: ByteStream) -> RSWFormat: return rsw_format +func convert(name: String, data_path: String) -> Node3D: + var gnd_file_path = "%s/data/%s" % [data_path, gnd_file] + var gnd = GNDFormat.from_bytes(ByteStream.from_bytes(FileAccess.get_file_as_bytes(gnd_file_path))) + + var gat_file_path = "%s/data/%s" % [data_path, gat_file] + var gat = GATFormat.from_bytes(ByteStream.from_bytes(FileAccess.get_file_as_bytes(gat_file_path))) + + var node := Node3D.new() + node.name = name + node.set_script(load("res://extractor/map.gd")) + + for resource in map_resources: + if resource is RSWFormat.SpatialAudioSource: + var audio_file_path := "%s/data/wav/%s" % [data_path, resource.audio_file] + if not FileAccess.file_exists(audio_file_path): + continue + + var audio = AudioStreamPlayer3D.new() + audio.stream = load(audio_file_path) + audio.name = resource.audio_file + audio.position = resource.get_position() + audio.volume_linear = resource.volume_gain + audio.max_distance = resource.audio_range + node.add_child(audio, true) + audio.owner = node + + var surface_tool := SurfaceTool.new() + for surface: GNDFormat.Surface in gnd.surfaces: + pass + #surface_tool.add_vertex() + + return node + + class WaterConfiguration: ## Byte Type: f32 [br] ## Byte Length: 4 |