mirror of
https://github.com/nolen777/eagle0.git
synced 2026-07-28 23:55:43 +00:00
* Add missing Unity .meta files, HoneyBadger import artifacts, and fix_import.py Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Remove HoneyBadger import artifacts and gitignore FBX auto-generated files Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
48 lines
1.5 KiB
Python
48 lines
1.5 KiB
Python
#!/usr/bin/env python3
|
|
"""Fix the imported rawGray by restoring ocean/border pixels from original."""
|
|
import gzip
|
|
from collections import Counter
|
|
from pathlib import Path
|
|
|
|
import numpy as np
|
|
|
|
SCRIPT_DIR = Path(__file__).parent
|
|
UNITY_ASSETS = (
|
|
SCRIPT_DIR.parent.parent
|
|
/ "src/main/csharp/net/eagle0/clients/unity/eagle0/Assets/Eagle"
|
|
)
|
|
|
|
# Load original
|
|
with gzip.open(UNITY_ASSETS / "rawGray.gz.bytes", "rb") as f:
|
|
orig = np.frombuffer(f.read(), dtype=np.uint8).reshape(1834, 3786)
|
|
|
|
# Load imported (with broken ocean)
|
|
with gzip.open(SCRIPT_DIR / "output/rawGray.gz.bytes", "rb") as f:
|
|
imported = np.frombuffer(f.read(), dtype=np.uint8).reshape(1834, 3786).copy()
|
|
|
|
# Restore ocean/border from original
|
|
ocean_or_border = (orig == 0) | (orig == 255)
|
|
imported[ocean_or_border] = orig[ocean_or_border]
|
|
|
|
# Now check real changes
|
|
diff = orig != imported
|
|
print(f"Real province changes: {np.sum(diff):,} pixels")
|
|
|
|
changed_from = orig[diff]
|
|
changed_to = imported[diff]
|
|
transitions = Counter(zip(changed_from.tolist(), changed_to.tolist()))
|
|
print("Transitions:")
|
|
for (fr, to), count in transitions.most_common(20):
|
|
print(f" {fr:3d} -> {to:3d}: {count:,}")
|
|
|
|
# Show bounding box of changes
|
|
ys, xs = np.where(diff)
|
|
if len(ys) > 0:
|
|
print(f"\nChange region: raw_y [{ys.min()}, {ys.max()}], raw_x [{xs.min()}, {xs.max()}]")
|
|
|
|
# Save fixed version
|
|
data = imported.astype(np.uint8).tobytes()
|
|
with gzip.open(SCRIPT_DIR / "output/rawGray.gz.bytes", "wb") as f:
|
|
f.write(data)
|
|
print("Saved fixed import to output/rawGray.gz.bytes")
|