diff options
author | Daniel Weipert <git@mail.dweipert.de> | 2025-01-05 16:54:36 +0100 |
---|---|---|
committer | Daniel Weipert <git@mail.dweipert.de> | 2025-01-05 16:54:36 +0100 |
commit | 35b0f811f23f029110373798b19d9d0895d907f0 (patch) | |
tree | 2e4906a992c2569fa0f89dbe0f079010a734cc41 /extractor/rsw_format.gd | |
parent | e08a29e73ea4f7e6d78e8e7f5a6e7033dbc1f542 (diff) |
next commit
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 |