tool: combine render-{images,timelapse}
Also adds imagemagick step to great gif!
shwarp
Sat, 15 Aug 2026 19:09:16 -0400
2 files changed,
23 insertions(+),
37 deletions(-)
D
tools/render-images
@@ -1,27 +0,0 @@
-#!/bin/bash - - -if [[ $# -ne 3 ]] -then - echo "Usage: ./render-images <GIT_DIR> <MAP_FILENAME> <OUTPUT_DIR>" - echo -e "\texample: ./render-images . FOO.WAD out" - - exit 1 -fi - -GIT_DIR="$1" -MAP_FILENAME="$2" -OUTPUT_DIR="$3" - -mkdir -p "$OUTPUT_DIR" - -for commit in $(git -C "$GIT_DIR" log --oneline --reverse --format=format:%at_%h) -do - echo "$commit" - timestamp=$(echo $commit | cut -d_ -f1) - sha=$(echo $commit | cut -d_ -f2) - - git show \ - ${sha}:${MAP_FILENAME} \ - > ${OUTPUT_DIR}/${timestamp}_${sha}.${MAP_FILENAME} -done
M
tools/render-timelapse
→
tools/render-timelapse
@@ -1,21 +1,34 @@
#!/bin/bash -if [[ $# -lt 1 ]] + +if [[ $# -ne 3 ]] then - echo "Usage: ./render-timelapse <FILES...>" - echo - echo -e "\tExample: ./render-timelapse ./file1.svg ./file2.svg" - echo -e "\tExample: ./render-timelapse ./files-dir/*.svg" + echo "Usage: ./render-timelapse <GIT_DIR> <MAP_FILENAME> <OUTPUT_DIR>" + echo -e "\texample: ./render-images . FOO.WAD out" exit 1 fi -FILES="$@" +GIT_DIR="$1" +MAP_FILENAME="$2" +OUTPUT_DIR="$3" + +mkdir -p "$OUTPUT_DIR" + +for commit in $(git -C "$GIT_DIR" log --reverse --format=format:%at_%h) +do + timestamp=$(echo $commit | cut -d_ -f1) + sha=$(echo $commit | cut -d_ -f2) -for file in $FILES + git -C "$GIT_DIR" show \ + ${sha}:${MAP_FILENAME} \ + > ${OUTPUT_DIR}/${timestamp}_${sha}.${MAP_FILENAME} +done + +for file in $OUTPUT_DIR/*.WAD do - ~/doom/tools/wad2svg/wad2svg $file MAP01 > "${file}.svg" + ~/doom/tools/wad2svg/wad2svg $file MAP01 > "${file}.svg" 2>/dev/null done -# TODO animate svgs -# eg. ~/doom/tools/wad2svg/wad2svg <WAD_PATH> <MAP01> +magick -delay 50 -loop 0 "${OUTPUT_DIR}/*.svg" "${OUTPUT_DIR}/${MAP_FILENAME}.gif" +