From d86ab8a2c618eff37ebdbe49a294df51b090d40c Mon Sep 17 00:00:00 2001 From: div0 Date: Wed, 30 Jul 2008 16:39:25 +0000 Subject: [PATCH] add shell script running brightspot... and it indeed IS broken git-svn-id: svn://svn.icculus.org/nexuiz/trunk@3983 f962a42d-fe04-0410-a3ab-8c8b0445ebaa --- misc/brightspot.c | 14 +------------- misc/brightspot.sh | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 13 deletions(-) create mode 100644 misc/brightspot.sh diff --git a/misc/brightspot.c b/misc/brightspot.c index 8e322948c..bc135f939 100644 --- a/misc/brightspot.c +++ b/misc/brightspot.c @@ -1,25 +1,13 @@ #include #include -// USAGE: -// for X in *.tga; do convert "$X" -geometry 512x512 -depth 8 GRAY:-; done > /tmp/foo -// brightspot /tmp/foo +// USAGE: see brightspot.sh (and in the future brightspot.bat) // It should output the right parameters for the sun direction in q3map2's format. // But probably is broken. #define false 0 #define true 1 -int sides_alphabet[6] = -{ - 2, // bk - 5, // dn - 3, // ft - 1, // lf - 0, // rt - 4 // up -}; - int flip[6*3] = { false, false, true, // "rt" diff --git a/misc/brightspot.sh b/misc/brightspot.sh new file mode 100644 index 000000000..d2131adc4 --- /dev/null +++ b/misc/brightspot.sh @@ -0,0 +1,36 @@ +#!/bin/sh + +if [ -z "$1" ]; then + echo>&2 "Usage: $0 foo_rt.jpg" + exit 1 +fi + +brightspot= +if which brightspot-bin >/dev/null; then + brightspot=brightspot-bin +else + case "$0" in + */*) + mydir=${0%/*} + ;; + *) + mydir=. + ;; + esac + brightspot="$mydir/brightspot-bin" + [ "$brightspot" -nt "$mydir/brightspot.c" ] || gcc -lm -O3 -Wall -Wextra "$mydir/brightspot.c" -o "$brightspot" || exit 1 +fi + +i=$1 +ext=${i##*.} +name=${i%.*} +name=${name%_[rlbfud][tfktpn]} + +{ + convert "$name"_rt."$ext" -depth 8 -geometry 512x512 GRAY:- + convert "$name"_lf."$ext" -depth 8 -geometry 512x512 GRAY:- + convert "$name"_bk."$ext" -depth 8 -geometry 512x512 GRAY:- + convert "$name"_ft."$ext" -depth 8 -geometry 512x512 GRAY:- + convert "$name"_up."$ext" -depth 8 -geometry 512x512 GRAY:- + convert "$name"_dn."$ext" -depth 8 -geometry 512x512 GRAY:- +} | "$brightspot" /dev/stdin -- 2.39.2