refactor(M03): extract WMO placement resolver

This commit is contained in:
2026-07-17 00:22:53 +04:00
parent f01302fd44
commit 05e216a953
9 changed files with 530 additions and 32 deletions
+32
View File
@@ -0,0 +1,32 @@
class_name WmoPlacementResolver
extends RefCounted
## Stateless WMO cache-key, placement-identity and world-transform rules.
## Returns the historical lowercase slash-normalized relative WMO cache key.
func normalize_relative_path(relative_wmo_path: String) -> String:
return relative_wmo_path.replace("\\", "/").to_lower()
## Returns the positive MODF unique-ID key or the historical tile/index fallback.
func resolve_unique_key(
placement: Dictionary,
tile_key: String,
placement_index: int
) -> String:
var unique_id := int(placement.get("unique_id", -1))
if unique_id > 0:
return "uid:%d" % unique_id
return "tile:%s:%d" % [tile_key, placement_index]
## Returns the world-space Godot transform used by every WMO instance path.
func resolve_world_transform(placement: Dictionary) -> Transform3D:
var world_position: Vector3 = placement.get("pos", Vector3.ZERO)
var rotation_radians: Vector3 = placement.get("rot", Vector3.ZERO)
var scale_value := float(placement.get("scale", 1.0))
return Transform3D(
Basis.from_euler(rotation_radians).scaled(Vector3.ONE * scale_value),
world_position
)
@@ -0,0 +1 @@
uid://02omydj0sxmo