Malen mit Symmetrie: Überlappung beider Seiten nimmt den stärkeren Anteil (stetig statt Mittelsenkrechten-Kante)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
slyphax 2026-10-25 00:55:18 +02:00
parent 7f06e28472
commit 5a70824dd5

View file

@ -158,6 +158,14 @@ func _punkt(idx: int) -> int:
return int(_mats[idx]) | (int(_mix_b[idx]) << 8) | (int(_mix_w[idx]) << 16)
## Anteil (0–255) des Materials m an einem gepackten Punkt.
static func _anteil(v: int, m: int) -> int:
var a := v & 0xFF
var b := (v >> 8) & 0xFF
var w := (v >> 16) & 0xFF
return (255 - w if a == m else 0) + (w if b == m else 0)
func _setze_punkt(idx: int, v: int) -> void:
_mats[idx] = v & 0xFF
_mix_b[idx] = (v >> 8) & 0xFF
@ -566,9 +574,12 @@ func _mirror_mats(snap: Dictionary, g: Vector2) -> void:
var midx: int = mirror.y * _mres + mirror.x
var value: int = _punkt(idx)
if snap.has(mirror) and _punkt(midx) != int(snap[mirror]):
# Beide Seiten bemalt (Pinsel überlappt die Achse): der näher am
# Strichpunkt liegende Wert gewinnt, beide bekommen ihn.
if _cell_dist(mirror, g, cell_x, cell_z) < _cell_dist(pos, g, cell_x, cell_z):
# Beide Seiten bemalt (Pinsel überlappt sein Spiegelbild, z. B. nahe
# der Kartenmitte): der Wert mit dem GRÖSSEREN Anteil des Mal-
# Materials gewinnt. Vorher „näher am Strichpunkt“ — das zog entlang
# der Mittelsenkrechte eine harte gerade Kante durch weiche Verläufe
# (Sly 25.10.). Max ist stetig und symmetrisch.
if _anteil(_punkt(midx), _stroke_material) > _anteil(value, _stroke_material):
value = _punkt(midx)
_setze_punkt(idx, value)
done[mirror] = true