summaryrefslogtreecommitdiff
path: root/extractor/rsw_format.gd
diff options
context:
space:
mode:
Diffstat (limited to 'extractor/rsw_format.gd')
-rw-r--r--extractor/rsw_format.gd97
1 files changed, 97 insertions, 0 deletions
diff --git a/extractor/rsw_format.gd b/extractor/rsw_format.gd
index 18874e2..ea1bf26 100644
--- a/extractor/rsw_format.gd
+++ b/extractor/rsw_format.gd
@@ -231,6 +231,13 @@ enum ParticlePresetEffect {
TunaParty = 1097,
}
+enum QuadTreeQuadrant {
+ BottomLeft = 0,
+ BottomRight = 1,
+ TopLeft = 2,
+ TopRight = 3,
+}
+
class Animated3DModel extends MapResource:
## Byte Type: u8 [br]
@@ -517,3 +524,93 @@ class ParticleEffectEmitter extends MapResource:
resource.launch_parameter_d = bytes.decode_float()
return resource
+
+
+class QuadTree:
+ ## Byte Type: f32 [br]
+ ## Byte Length: 4 [br]
+ ## coordinate of the corner at the lowest altitude
+ var bottom_x: float
+
+ ## Byte Type: f32 [br]
+ ## Byte Length: 4
+ var bottom_y: float
+
+ ## Byte Type: f32 [br]
+ ## Byte Length: 4
+ var bottom_z: float
+
+ ## Byte Type: f32 [br]
+ ## Byte Length: 4 [br]
+ ## coordinate of the corner at the highest altitude
+ var top_x: float
+
+ ## Byte Type: f32 [br]
+ ## Byte Length: 4
+ var top_y: float
+
+ ## Byte Type: f32 [br]
+ ## Byte Length: 4
+ var top_z: float
+
+ ## Byte Type: f32 [br]
+ ## Byte Length: 4 [br]
+ ## width of the bounding box (when interpreted as a cuboid)
+ var diameter_x: float
+
+ ## Byte Type: f32 [br]
+ ## Byte Length: 4 [br]
+ ## height of the bounding box (when interpreted as a cuboid)
+ var diameter_y: float
+
+ ## Byte Type: f32 [br]
+ ## Byte Length: 4 [br]
+ ## depth of the bounding box (when interpreted as a cuboid)
+ var diameter_z: float
+
+ ## Byte Type: f32 [br]
+ ## Byte Length: 4 [br]
+ ## coordinate of the point in the exact center of the box
+ var center_x: float
+
+ ## Byte Type: f32 [br]
+ ## Byte Length: 4
+ var center_y: float
+
+ ## Byte Type: f32 [br]
+ ## Byte Length: 4
+ var center_z: float
+
+ ## Length: 4 [br]
+ ## null if leaf node at sub-tree level 5 [br]
+ ## indexes are [enum QuadTreeQuadrant]
+ var quadrants: Array[QuadTree]
+
+
+ func get_bottom() -> Vector3:
+ return Vector3(bottom_x, bottom_y, bottom_z)
+
+
+ func get_top() -> Vector3:
+ return Vector3(top_x, top_y, top_z)
+
+
+ func get_diameter() -> Vector3:
+ return Vector3(diameter_x, diameter_y, diameter_z)
+
+
+ func get_center() -> Vector3:
+ return Vector3(center_x, center_y, center_z)
+
+
+ static func from_bytes(bytes: ByteStream) -> QuadTree:
+ var tree = QuadTree.new()
+
+ tree.bottom_x = bytes.decode_float()
+
+ return tree
+
+
+ static func from_bytes_recursive(bytes: ByteStream, tree: QuadTree, depth: int):
+ if depth == 5 or tree.quadrants.size() == 4:
+ pass