#!/usr/bin/env bash
# Regenera los golden screenshots para el test visual (issue 0048).
#
# Uso:
#   cpp/scripts/update_goldens.sh
#
# Compila primitives_gallery, lo lanza con --capture sobre cpp/tests/golden/,
# y deja PNG por demo. Use LIBGL_ALWAYS_SOFTWARE=1 si no hay GPU/driver.
set -euo pipefail
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
cmake -S "$ROOT" -B "$ROOT/build" -DCMAKE_BUILD_TYPE=Release
cmake --build "$ROOT/build" --target primitives_gallery -j"$(nproc)"
mkdir -p "$ROOT/tests/golden"
LIBGL_ALWAYS_SOFTWARE=1 \
    "$ROOT/build/apps/primitives_gallery/primitives_gallery" \
    --capture "$ROOT/tests/golden"
echo "Goldens regenerated: $ROOT/tests/golden/"
